0
Reply

Launch & controlling a new application instance via COM

David Kepple

David Kepple

Feb 4 2009 12:01 PM
2.2k

I am having a problem where I have a COM application that can be run stand-alone and programatically via COM interop.  If an instance of the COM application is being run when my .NET application that does the COM interop starts, it latches onto a currently running instance rather than making a new instance for itself.

So here are the facts of my situation.  

  • I have a Delphi 7 app that implements a COM Server.
  • I have imported a reference to this application in a VS 2008 project by adding a reference to the COM server.
  • It works great if there are no previous running instances of the application prior to executing my .NET application.
  • If there is 1 or more instances of the application executing, when the constructor for implementing the COM Interop class is executed it just latches on or hooks into one of the already running instance of the application.
  • Instead of the above happening I would like to create a new instance of the application and hook onto that one.

I think that the above points make my very special situation really clear now.  If still not yet clear a co-worker of mine has posted a on the stackoverflow forum with the same question worded in his own way.   (Link to post)

Any help would be appreciated.

I am new to COM Interop, but wouldn't this be the same as doing automation in Word or Excel?  This issue would most likely come up a lot I would think.