Launching multiple instances of a program with win32com.client.Dispatch?

  • Thread starter tyler.schlosser
  • Start date
T

tyler.schlosser

Hi there, I am trying to launch a program called AmiBroker using the
command:

AB = win32com.client.Dispatch("Broker.Application")

However, I have a dual-core CPU and would like to launch two instances
of AmiBroker. I know it is possible to run two instances simultaneously
since it is easy to do manually by double-clicking the AmiBroker.exe
file twice. However, when I write two lines of code like this:

AB = win32com.client.Dispatch("Broker.Application")
AB2 = win32com.client.Dispatch("Broker.Application")

and proceed to address these objects, they interfere with each other
since both AB and AB2 are "grabbing" the same instance of AmiBroker. If
I try to run two separate Python scripts, each one containing a
"win32com.client.Dispatch("Broker.Application")" comand, the same
problem happens (where even though the objects are named differently,
they do not each launch an instance of the program; the first one
launches it and the second one just "grabs" it).

Does anyone know how to force two separate program launches rather than
having both Dispatch commands access the same object? I would be
incredibly thankful to anyone who could offer some help with this.

Thank you very much,

Tyler
 
T

tyler.schlosser

Hi Roger,

Thanks for the response, but DispatchEx seems to do the exact same
thing as Dispatch in my case; there is still only one processID and one
instance of my program (I forgot to mention that I also need two unique
processID's to keep track of them).

I have also tried:

###

AB1 =
pythoncom.CoCreateInstance("Broker.Application",None,pythoncom.CLSCTX_SERVER,pythoncom.IID_IDispatch)

AB2 =
pythoncom.CoCreateInstance("Broker.Application",None,pythoncom.CLSCTX_SERVER,pythoncom.IID_IDispatch)

win32com.client.Dispatch(AB1)
win32com.client.Dispatch(AB2)

###

That also seems to do the exact same thing.

Any other ideas of things I might try?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top