CreateInstance of COM object in specific process from C#
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: CreateInstance of COM object in specific process from C#

  1. #1
    Join Date
    May 2011
    Posts
    2

    Question CreateInstance of COM object in specific process from C#

    Context:
    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)

  2. #2
    Join Date
    May 2011
    Posts
    2

    Re: CreateInstance of COM object in specific process from C#

    Not CreateObjectRef - CreateObjRef of course

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center