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?
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: