Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jun Tangunan
  Where is Jun Tangunan?
 Cabanatuan
 Philippines
 Jun Tangunan
 To: Mike Gagnon
  Where is Mike Gagnon?
 Pointe Claire
 Canada
 Mike Gagnon
 Tags
Subject: RE: Kill EXE API
Thread ID: 416387 Message ID: 416397 # Views: 48 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Win32API programming
Date: Monday, December 29, 2014 7:16:19 AM         
   


> >
> >
KillProcess("YourApp.exe")
> > 
> > **************
> > Function KillProcess("cProcess")
> > **************
> > Local loWMI, lcQuery, loResult, loProcess
> > loWMI = Getobject("winmgmts://")
> > lcQuery = '"select * from win32_process where name='+"'"+Alltrim(m.cProcess)+"'"+ ' "'
> > lcSQL=&lcQuery
> > loResult = loWMI.ExecQuery(m.lcSQL)
> > If loResult.Count > 0
> > 	For Each loProcess In loResult
> > 		loProcess.Terminate(0)
> > 	Next
> > Endif
> > Endfunc

> >
> >
> > https://vfpx.codeplex.com/releases/view/99045
> > http://sandstorm36.blogspot.com
>
> No scripting?
>
> Mike Gagnon


My fault. :)

Please see my new answer under Pete. I think I am still missing something because after a successful close, running the function again do not close anymore the running process; unless I exit VFP and open it again in which case it can successfully terminate the target process. Maybe you can supply what is missing there?


https://vfpx.codeplex.com/releases/view/99045
http://sandstorm36.blogspot.com

ENTIRE THREAD

Kill EXE API Posted by Pete Sass @ 12/29/2014 1:40:46 AM
RE: Kill EXE API Posted by Chuanbing Chen @ 12/29/2014 1:55:13 AM
RE: Kill EXE API Posted by Pete Sass @ 12/29/2014 2:09:06 AM
RE: Kill EXE API Posted by Jun Tangunan @ 12/29/2014 2:21:49 AM
RE: Kill EXE API Posted by Pete Sass @ 12/29/2014 3:11:45 AM
RE: Kill EXE API Posted by Jun Tangunan @ 12/29/2014 7:13:26 AM
RE: Kill EXE API Posted by Mike Gagnon @ 12/29/2014 3:12:39 AM
RE: Kill EXE API Posted by Jun Tangunan @ 12/29/2014 7:16:19 AM
RE: Kill EXE API Posted by Pete Sass @ 12/29/2014 12:07:30 PM
RE: Kill EXE API Posted by Mike Gagnon @ 12/29/2014 12:28:36 PM
RE: Kill EXE API Posted by Pete Sass @ 12/29/2014 1:46:26 PM
RE: Kill EXE API Posted by Greg Green @ 12/29/2014 3:44:35 AM
RE: Kill EXE API Posted by Pete Sass @ 12/29/2014 1:22:22 PM
RE: Kill EXE API Posted by Jun Tangunan @ 12/30/2014 1:30:04 AM
RE: Kill EXE API Posted by Mike Gagnon @ 12/30/2014 5:48:41 PM
RE: Kill EXE API Posted by Pete Sass @ 12/30/2014 6:20:59 PM
RE: Kill EXE API Posted by Victor Espina @ 12/29/2014 3:38:47 PM