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

tyler.schlosser at gmail.com tyler.schlosser at gmail.com
Fri Jul 7 11:30:08 EDT 2006


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?

Roger Upole wrote:
> win32com.client.DispatchEx should create a new instance.
>
>        Roger
>
> <tyler.schlosser at gmail.com> wrote in message news:1152238469.455365.239520 at s26g2000cwa.googlegroups.com...
> > 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
> >




More information about the Python-list mailing list