How can i close another program(exe)using vb application?
-Khamal-
Printable View
How can i close another program(exe)using vb application?
-Khamal-
If you know the Window Handle (hWnd) of that window, then you can do something like this:
------------------Code:Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_DESTROY = &H2
Private Sub Command1_Click()
Dim lHwnd As Long
'lHwnd should be your hWnd of the program you want to close
Call SendMessage(lHwnd, WM_DESTROY, 0, 0)
End Sub
Serge
Senior Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819