|Subject:||CreateObject, GetObject and COM instances - need help!|
|Date:||Wed, 20 Feb 2008|
I am working with an external windows application that I can launch
using Start/Programs/ProgramLaunchIcon multiple times. Each time I
manually launch the program in this manner, I get a new window and a new
process in the task manager.
This software has allows programmers to programmatically launch the
application via the COM call
MyVariableName = CreateObject("ApplicationName.Application").
However, if I try to issue that command multiple times (with different
variable names i.e. an array of names), I will only ever get one
instance of the application launched (one item listed in the task manager).
I would very much like to launch multiple instances programmatically. I
looked on MSDN and it stated that COM applications can either be single
instanced or multi-instanced. The manual launching of the program
multiple times leads me to believe that it is a multi-instantiable COM
program, but the failure of being able to launch multiple instances
using CreateObject() command leads me to believe otherwise.
Can anyone give me a definitive answer based on the above 'evidence'?
Continuing from this point, since I can manually launch multiple
instances, that means I can manually launch multiple instances using the
Shell() command. How can I obtain control over each launched instance
if I launch them this way? The GetObject command would seem to not care
which one it 'gets' if there are multiple launched. So, is there a more
advanced version of GetObject that allows me to specify more information?
If I shell copy the executable to a new name, the task manager listing
changes. Would this rather crude work-around allow GetObject to
properly control these two (or more) instances of the same COM application?
Thanks in advance.