May 17th, 2011, 09:35 AM
CreateInstance of COM object in specific process from C#
I'm writing a C# application (MyApp) which integrates with a .exe hosted COM server (ServerApp). I have no access to modify ServerApp in the short-term.
ServerApp can be started multiple times to allow multiple 'documents' to be opened, each in separate processes.
MyApp is initiated from a menu in ServerApp allowing two 'documents' to be virtually linked through MyApp, so I need to open a second instance of ServerApp (which I'm successfully doing with Process.Start()) and call some methods on ServerApp's COM API to navigate to a certain location in the newly opened 'document'.
The trouble is that Activator.CreateInstance(Type.GetTypeFromProgId("ServerApp.Editor")) always returns a ServerApp.Editor object in the ServerApp process which initially called MyApp.
What I'd love to be able to do is CreateInstance in the context of the new Process I started (the second ServerApp process).
Does anyone know how this might be acheived? I've been looking for something on Process (wondered whether remoting and CreateObjectRef might be the way forward)
May 17th, 2011, 09:37 AM
Re: CreateInstance of COM object in specific process from C#
Not CreateObjectRef - CreateObjRef of course
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!