COM Containment
-
I have a work assignment wherein I have to create a COM object to contain another COM object. The inner object was not aggregatable or poolable on Win2K server, so we needed to wrap it. I'm to the point where I need to pass the function calls to the contained object. My problem is that I can't get an interface pointer to the inner objects custom interface. How would I go about this? I tried creating an IID using the value the inner object registered in the registry, but I keep getting compiler errors when I try that. How can I create a variable of the type of the inner object's custom interface since I don't have any source/headers for this object (I do have the IDL and the DLL, of course, but that's it). Time is of the essence here! I'm stuck! Thanks in advance.
-
I have a work assignment wherein I have to create a COM object to contain another COM object. The inner object was not aggregatable or poolable on Win2K server, so we needed to wrap it. I'm to the point where I need to pass the function calls to the contained object. My problem is that I can't get an interface pointer to the inner objects custom interface. How would I go about this? I tried creating an IID using the value the inner object registered in the registry, but I keep getting compiler errors when I try that. How can I create a variable of the type of the inner object's custom interface since I don't have any source/headers for this object (I do have the IDL and the DLL, of course, but that's it). Time is of the essence here! I'm stuck! Thanks in advance.
import the .dll and use the CreateInstance method. Say the interface is named X.A
#import X.dll no_namespace
IAPtr ppA;try { CoInitialize(NULL); ppA.CreateInstance(\_\_uuidof(A)); ppA->Somemethod(); ppCrypt->Release(); CoUninitialize();
Thanks for the help, Bill
-
import the .dll and use the CreateInstance method. Say the interface is named X.A
#import X.dll no_namespace
IAPtr ppA;try { CoInitialize(NULL); ppA.CreateInstance(\_\_uuidof(A)); ppA->Somemethod(); ppCrypt->Release(); CoUninitialize();
Thanks for the help, Bill
The line ppCrypt->Release(); should read ppA->Release(); Thanks for the help, Bill