I am trying to obtain an interface to an Automation Server which resides in a separate executable on the same machine (for example, Word (it's not word, but its the same type of server)).
I am successful at getting an interface and can then call methods with the IDispatch::Invoke method, however it starts a new instance of the EXECUTABLE each time I use CoGetClassObject (once per program run), even if the app is running already.
The SDK says it will first look for the server, and only create one when it is not available.
This is all done in C++ (MSVC 4.2). If I do the same thing in vb (dim object, etc.) it uses the instance of my server already running). Here is a snipet of code:
hr = CoGetClassObject( Clsid,
(LPVOID *)&pIClassFactory );
pIClassFactory->CreateInstance(pUnk, IID_IDispatch, (LPVOID *)&m_pDispatch);
return FALSE; // (failture)