|
-
March 29th, 2001, 07:57 AM
#1
Closing a app from other app...using VB?
I want to kill a process from my application
how to do that??
expecting details.....
Rgds,
Vishal
:-)
-
March 29th, 2001, 08:02 AM
#2
Re: Closing a app from other app...using VB?
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
[email protected]
-
March 29th, 2001, 08:02 AM
#3
Re: Closing a app from other app...using VB?
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|