vhgupta
March 29th, 2001, 06:57 AM
I want to kill a process from my application
how to do that??
expecting details.....
Rgds,
Vishal
:-)
how to do that??
expecting details.....
Rgds,
Vishal
:-)
|
Click to See Complete Forum and Search --> : Closing a app from other app...using VB? vhgupta March 29th, 2001, 06:57 AM I want to kill a process from my application how to do that?? expecting details..... Rgds, Vishal :-) Iouri March 29th, 2001, 07:02 AM Find window handle and then terminate this window Declare Function GetWindowThreadProcessId Lib "user32" (ByVal Hwnd As Long, lpdwProcessId As Long) As Long Declare Function TerminateProcess Lib "kernel32" (ByVal ApphProcess As Long, ByVal uExitCode As Long) As Long Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal blnheritHandle As Long, ByVal dwAppProcessId As Long) As Long Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Const PROCESS_ALL_ACCESS = 0 Function KillWindow(Hwnd) Dim PROCESSID As Long Dim exitcode As Long Dim MyProcess As Long Call GetWindowThreadProcessId(Hwnd, PROCESSID) ' Get the processid from the window MyProcess = OpenProcess(PROCESS_ALL_ACCESS, False, PROCESSID) ' open the process by processid AppKill = TerminateProcess(MyProcess, exitcode) ' Terminate the process by process Call CloseHandle(MyProcess) ' close the process End Function Iouri Boutchkine iouri@hotsheet.com Clearcode March 29th, 2001, 07:02 AM Try sending a WM_CLOSE message to it. See http://www.merrioncomputing.com/vb_killapp.htm HTH, Duncan ------------------------------------------------- Ex. Datis: Duncan Jones Merrion Computing Ltd http://www.merrioncomputing.com codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |