Hi all,
I have 3 instances of a COM server "Slaves" that I need to be accessed from yet another com server "Master" so I registered the Slaves in the ROT. - or so I think. :-)
Here is the code that registers the com server instances in the ROT. The code is
in the constructor.
This works in as much as it does indeed register the GUID(s) in the ROT.
I can open up IROTVEIWER and see my three COM server Slave instances there displayed by !{GUID}.
DWORD ROTCookie = 0;
GUID g;
CoCreateGuid(&g);
RegisterActiveObject(this, g, ACTIVEOBJECT_WEAK, &ROTCookie);
Then I send the GUIDs generated off to the COM server that needs to talk to these
and they arrive as expected and are the values generated back at the constructor.
I grabbed one of the SlaveGUIDs that was sent over from the constructor code above. GetActiveObject seems to work as I can codesense pUnk-> and see the QueryInterface, AddRef and Release funtcions.
But I want one of my own functions (MidiOutFromMaster() to call so I thought I might need to do a QI but it throws up a System.AccessViolationException. I must be doing something wrong along the way . I am a babe in the woods with respect to COM.
I've tried IID_this, that and the other thing out of ignorance in the QI line also.
IUnknown *pUnk;
void** ppv;
HRESULT hr = GetActiveObject(SlaveGUID, NULL, (IUnknown**)&pUnk);
hr = pUnk->QueryInterface( IID_IDispatch, ppv );
I feel close to my goal however.
Thanks in advance.
:Ron