1. ## 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)?

George

2. I think coGetClassObject

3. 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

Originally Posted by manohar.amit
I think coGetClassObject

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

5. 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

Originally Posted by CornedBee

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

6. 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**)

7. Thanks CornedBee,

Cool! I think my question is answered.

Originally Posted by CornedBee
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