Click to See Complete Forum and Search --> : Problem calling object in another exe thru automation


anand99
May 14th, 1999, 09:56 AM
I have an MFC application that is an automation server that implements one dispinterface object. Internally in this application I am creating other in-proc objects that reside in other COM dlls. These objects are all dual interface. I create an automation controller in vb and Get the dispinterface object from the ROT. Then I am trying to call a method on the dispinterface object that will return a pointer to one of the inproc dual interface objects in the application. The dispinterface object is retrieved fine from the ROT thru GetObject. However when I make the method call to retrieve the inproc dual interface object as shown below

Dim App as Object
Dim Test as MyTest

Set App = GetObject(, "MyServer.App")

Set Test = App.GetTest

Test is always nothing. I read that dual interfaces are automatically marshalled by OLE for us. The inproc objects that I am creating in my app are all dual interfaces. Do I need to do anything special to return these. Here is the implementation of the GetTest method in my application

LPUNKNOWN CApp::GetTest()
{
HRESULT hr = CoCreateInstance(CLSID_mytest1, NULL, CLSCTX_INPROC_HANDLER | CLSCTX_INPROC_SERVER, IID_Imytest1, (void**)&GetApp()->m_pITest);
IUnknown* pUnk;
GetApp()->m_pITest->QueryInterface(IID_IUnknown, (void**)&pUnk);
return pUnk;
}