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

How might I close all instances of MyApp.Exe from another Exe file?

Status
Not open for further replies.

Docpro777

Programmer
Jul 1, 2003
105
US
Having searched the FAQs, I've experimented with the following, but with no avail.
Any suggestions are appreciated in advance.
***************************************************
oManager = GETOBJECT("winmgmts:")
oApps = oManager.InstancesOf("Win32_process")
FOR EACH PROCESS IN oApps
IF 'MyApp.EXE' $ UPPER(PROCESS.NAME)
*!* Need something here to cause other instances of MyApp.Exe to QUIT (and hopefully cleanup, etc.)
ENDIF
NEXT
***************************************************

Thanks

Philip M. Traynor, DPM
 
SendMessage ( ) API call . . .
thread184-606568

Slighthaze = NULL
craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Start writing code that prevents your "MyApp.exe" to start up more than once.
 
DocPro777

[ol][li] Either, as suggested, prevent your application from starting twice,.[/li]

[li] Or if you are a member, the example of "Terminating all running applications from a VFP program" would do it for you.
The title is deceiving, but you can use the function to terminate only the ones you want.[/li][/ol]


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top