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!

Closing user defined .exe in Vb Program

Status
Not open for further replies.

RABOD

Technical User
Jan 25, 2003
37
0
0
GB
Hi all,

I have designed a program in Vb which allows the user to choose an .exe file (it could have any name).
However when the user closes the vb program the .exe process remains running.
What code can I use to stop this .exe process when the Vb program is closed.

Again, bare in mind that the process could be called anything.

Thanks (this is in VB6)
 
If you are opening the .exe using shell you can grab the process id when you shell the program e.g.
Code:
ProcId = Shell("your.exe")
You can then use this (or an array of ProcessID's) to kill the process(es) when you close you app.

A quick search on KillProcess turned up DrJavaJoe's example thread222-730420 (it also contains a link to a thread in which Hypetia posts an example of how to get a PID from a process name), there are also several other examples using the same principle of a KillProcess function.

Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top