Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveX Exe Client/Server Application

Status
Not open for further replies.

HyperPics

Programmer
Dec 11, 2003
1
US
I want to enhance an existing program that I have by building it into an ActiveX Exe vs a Standard Exe. This would allow me to change properties and run methods in the application from other running applications. One of the things that is bothering me is that I can't get it to work in the same fashion that Word does. You can create a client that launches Word and have the user close Word down without any problems. I am finding out that if the user closes my server app (ActiveX Exe) program it stays running in the background until I terminate al Clients that are working with it. Is this a limitation or is there a way around this? So I want my application to work similar to Word when it is called up stand-alone or through a call to CreateObject.

VB6 sp5/Windows 2000

Thanks for your help.
 
I think you should choose one of:
1. Create a multithreaded COM object and use references count to know when you should close application
2. Use singlethreaded COM object. In this case operation system will start a new instance of your program when is called solmewhere CoCreateInstance or CreateObject.

Note what single thread model does not mean you can use a single thread. This threading model is at COM level.

Ion Filipski
1c.bmp
 
Ok this is a issue of a difference between MultiUse and SingleUse Instancing property on your ActiveX EXE
A SingleUSe ActiveX EXE will create a new instance of the program for every component created.

So this diagram shows what happens

Code:
-------     ------
|   B |---->|  B |
|     |     ------
|A    |     ------  
|   B |---->|  B |
|     |     ------
-------
You can see that application A creates 2 instances of Component B. Component B is in a Single Use ActiveX EXE so for each Component a new instance of the Application is loaded into memory.


With MultiUse all instances of a component end up using the same application as in the diagram below
Code:
-------     ------
|   B |---->|  B |
|     |     |    |
|A    |     |    |  
|   B |---->|  B |
|     |     ------
-------

SingleUse has some advantages and disadvantages.
Pro
If one instance of the ActiveX EXE crashes non of the other components are effected
Con
SingleUse Components consume more resources because they keep loading up new instances of the application.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top