views:

17

answers:

1

There is a scenario I'm interested in. User runs COM based application in a separate window, I want my C# application to manipulate that application through COM calls. I've found COM interface I'm interested in and VisualStudio has successfully generated wrapper (MyApp.interop). So I can write something like new Interop.MyApplication() but I do not want new Application I want to work with existing one.

A: 

I've found the solution, code looks like

var app = Marshal.GetActiveObject("MapInfo.Application")
((MyApp)app).OpenFile(...)
Alex Ilyin