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

How do I Kill an instance of appllication

Status
Not open for further replies.

2969

IS-IT--Management
Oct 18, 2001
107
0
0
US
I have a program that calls an active X exe but for some reasons sometimes the activex exe when closed does not gets removed and still keeps running in the background or memory. So when i call the activex exe again, it says that I am running another instance and I have to go to task bar and close the application from their.

How can i make sure that if there is an instance alrady running, i need to close it and then run a fresh instance.

I am using VB6
 
How can i make sure that if there is an instance alrady running,


I wouldn't

I have a program that calls an active X exe but for some reasons sometimes the activex exe when closed does not gets removed and still keeps running in the background or memory.

I'd deal with the problem! Do you have the source for the active-X? I'd look through your calling code and ensure that all references to the active x are released correctly. Then I'd look at the active x and see what would be keeping that alive

Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
hi

I just use this to call the active exe

RunProgram App.path & "\TP2RQI.EXE"

I have already made sure that all lose ends are taken care such as an open adodb connections, any classes but even then I still get this error.

thx
 
I'll assume you have, or know how to obtain, the window handle (hWnd) of the application you want to kill. The easiest way to shut down another app is to ask it nicely. You can do this by sending the other app a WM_CLOSE SendMessage, you might want to use PostMessage or SendMessageTimeout to aviod hanging your app up.
This won't always work nd you may need to use TerminateProcess. Info on how to use these functions and how to obtain the hwnd of a process should be available form the vb6 MSDN database at microsoft.com

hope this helps.

Rebis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top