> > I've never seen an example of code that could find a running process and >terminate it without relying on the window title search. > >If you store _VFP.ProcessID at program start in some file, you can use the >following code to terminate the process. Just replace _VFP.ProcessID with >the handle read from that file: > > Local lnHandle > Declare Long OpenProcess in Win32API ; > Long dwDesiredAccess, ; > Long bInheritHandle, ; > Long dwProcessId > Declare TerminateProcess in Win32API ; > Long hProcess, ; > Long uExitCode > lnHandle = OpenProcess( 1, 0, _VFP.ProcessID ) > TerminateProcess( m.lnHandle, 1 )
Thanks, Christof. Of course, there's the problem of where to place the file... ;-) (Yes, I've received good solutions for that already.) This looks very useful. >If you need to do this based on the EXE name on all platforms including >Windows NT 4, it's a little bit more work. Here's an article with C++ code >to do this: Thanks for taking the time to include the article and the code. Fortunately, I don't have to support anything before Win 98. Ken www.stic-cil.org _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

