Currently my code uses
SurferApp = Marshal.GetActiveObject("Surfer.Application") as Surfer.Application
to get the running instance of a software called surfer, for the sake of simplicity we can replace Surfer to Word that everyone knows about.
Now let's say I have 2 MS word application running and I want to get both of them using Marshal.GetActiveObject()
, how can I get both the running instances and associate each with a separate object?
In addition to the links in the accepted answer, I found the following very helpful for walking the ROT, especially if the application you're interested in is AutoCAD:
http://adndevblog.typepad.com/autocad/2013/12/accessing-com-applications-from-the-running-object-table.html
Marshal.GetActiveObject returns the first instance it finds on ROT (running object table). If you have more than one instance running with the same name/id, you have to get it directly from ROT.
A few links to start:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With