Thread: COM CreateInstance method

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    COM CreateInstance method

    Hello everyone,


    I think there is only one COM CreateInstance method, which belongs to IClassFactory interface.

    Is there another CreateInstance method, which does not belongs to any class/interface and belongs to the COM global library function (like CoCreateInstance)?


    thanks in advance,
    George

  2. #2
    Registered User
    Join Date
    Nov 2007
    Posts
    11
    I think coGetClassObject

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thanks manohar.amit,


    Sorry that I have not made myself understood. My point is beyond the wellknown CreateInstance function in IClassFactory, are there any other methods (defined by COM interface/class, not by user defined function), which has the exact name of CreateInstance in your experience?

    Let me know if I have not made myself understood. In this question, I just want to know how many functions which have the same name of CreateInstance. :-)


    regards,
    George

    Quote Originally Posted by manohar.amit View Post
    I think coGetClassObject

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Grep the headers.

    Why do you want to know, anyway? This is a really weird question.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Hi CornedBee,


    I am reading some code from others, but currently I can not debug because of other reaons, and I want to know if I met with CreateInstance (if it is not defined by developer
    himself), it is the one belongs to IClassFactory?

    (the code contains some macro, because of no debug environment, I need to confirm with others)

    BTW: besides the CreateInstance from IClassFactory, are there any other method which has the same name in Microsoft COM SDK or related classes/interfaces?

    regards,
    George

    Quote Originally Posted by CornedBee View Post
    Grep the headers.

    Why do you want to know, anyway? This is a really weird question.

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Code:
    cd path\to\platformsdk
    grep CreateInstance *
    Only works if you have a grep utility, of course. But find in files does similar stuff.

    This tells me that the following CreateInstance methods exist:
    1) ObjectContext::CreateInstance(BSTR, VARIANT*)
    2) ITransactionContextEx::CreateInstance(REFCLSID, REFIID, void**)
    3) ITransactionContext::CreateInstance(BSTR, VARIANT*)
    4) ICreateWithTransactionEx::CreateInstance(ITransact ion*, REFCLSID, REFIID, void**)
    5) ICreateWithTipTransactionEx::CreateInstance(BSTR, REFCLSID, REFIID, void**)
    6) IObjectContext::CreateInstance(REFCLSID, REFIID, void**)
    7) ITypeInfo::CreateInstance(IUnknown*, REFIID, void**)
    8) IClassFactory::CreateInstance(IUnknown*, REFIID, void**)
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  7. #7
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thanks CornedBee,


    Cool! I think my question is answered.

    Quote Originally Posted by CornedBee View Post
    Code:
    cd path\to\platformsdk
    grep CreateInstance *
    Only works if you have a grep utility, of course. But find in files does similar stuff.

    This tells me that the following CreateInstance methods exist:
    1) ObjectContext::CreateInstance(BSTR, VARIANT*)
    2) ITransactionContextEx::CreateInstance(REFCLSID, REFIID, void**)
    3) ITransactionContext::CreateInstance(BSTR, VARIANT*)
    4) ICreateWithTransactionEx::CreateInstance(ITransact ion*, REFCLSID, REFIID, void**)
    5) ICreateWithTipTransactionEx::CreateInstance(BSTR, REFCLSID, REFIID, void**)
    6) IObjectContext::CreateInstance(REFCLSID, REFIID, void**)
    7) ITypeInfo::CreateInstance(IUnknown*, REFIID, void**)
    8) IClassFactory::CreateInstance(IUnknown*, REFIID, void**)

    regards,
    George

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. on method pointers and inheritance
    By BrownB in forum C++ Programming
    Replies: 2
    Last Post: 03-02-2009, 07:50 PM
  2. stuck on display method
    By shintaro in forum C++ Programming
    Replies: 2
    Last Post: 02-01-2009, 05:17 PM
  3. C# method
    By siten0308 in forum C# Programming
    Replies: 6
    Last Post: 07-15-2008, 07:01 AM
  4. Overriding a method in C
    By DavidDobson in forum C Programming
    Replies: 1
    Last Post: 07-05-2008, 07:51 AM
  5. Replies: 2
    Last Post: 01-22-2008, 04:22 PM