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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Active-X-Exe self terminate

Status
Not open for further replies.

tmighty

Programmer
Feb 15, 2008
1
0
0
DE
MultiUse/ SingleUse-Active-X-Exe question:

There is a great post that my question builds on:

I would like to find out how I can let the Active-X-Exe terminate. During development it happens quite often that I have to set back my application, and since my Active-X-Exe works with the comm ports, I must reboot quite often when the Active-X-Exe does not terminate in a normal way and closes the comm ports again.

There I have a form inside the ActiveX-Exe that has a timer.
Each 5 seconds the timer calls the FindWindow procedure to determine if the client is still alive. If FindWindow returns 0, it shall terminate itself.

But calling this code (in the module) does not really do anything:

Public Sub UnloadAll()

MsgBox "unload all"
Unload mForm
Set mForm = Nothing
gObjectCount = 0
Set gSystemVariable = Nothing

End Sub

My Active-X-Exe stays alive.
I played around with it some hours now, but I could find the solution.

Thank you.
 
From
An out-of-process component written with Visual Basic will shut down when:

The component has no forms loaded. A loaded form will keep your component running past the point at which all references have been released. Forms should be unloaded when the object that created them terminates.

No out-of-process client applications are holding references to the component’s public objects. Internal references to public objects will not keep a component running if clients have released all their references. Neither will references held by an in-process component the out-of-process component is using.

No code in the component’s modules is currently executing, or in the calls list waiting to be executed.

The component is not in the process of being started in response to a client application’s request for an object.

It seems likely that one of the above conditions isn't met in your code.

HTH

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top