How to have several instances of VB6 Exe ActiveX in task manager

554 Views Asked by At

I made a VB6 EXE ActiveX that is used by a windows service and I would like to know if there any possibility to have several processes of this exe simultaneously in task manager ?

For example, we use AltovaXML_COM.exe to perform XSL transformation and each time I create an instance a new process is created, so in task manager we have severals independant processes.

Is there possible with VB6 exe ActiveX ?

Our exe Active X creates svg files and we want to perform severals generation of these files simultaneously.

Thanks for your help

2

There are 2 best solutions below

7
On

Every instance of an AX EXE will show up as a separate entry (process) in the task manager. One program can instantiate an AX EXE several times, or multiple programs may instance it one of more times. This isn't something the AX EXE does by itself, it's something other programs using the AX EXE do.

2
On

Yes, it is possible. The default behavior of an ActiveX exe is to have every application that creates a reference to your exe share a single instance of it in a single process. If you want to change this so that each reference creates its own separate exe in a separate process, then change the Instancing property from MultiUse to SingleUse.

You can't do this programmatically at runtime; you have to do it in the IDE. In the Project window, click on the class, and you'll see the Instancing property in the Properties window.

Another thing you may want to experiment with as a possible alternative is the threading model. The default, again, is one process handling all references (MultiUse) but also a single thread handling all references. To change this, you can go into the Project properties (bottom selection on the Project menu) and look at the Threading Model area in the lower right of the dialog box.

The default is a thread pool with one thread. If you change this to "thread per object" you will create a new thread each time you create a reference to your ActiveX Exe. You can also change the thread pool number to add more threads to it. If you do this, the threads are assigned on a round robin basis: if you have, say, five threads in your pool and six instances, two of the instances (VB won't tell you which, so beware) will share the first thread.

So, if you need multiple instances of your EXE, then change the instancing property to SingleUse. But if you are looking to enhance performance and execution time, you might find that multiple threads in one process is something to investigate as well.