Hi...
Let's say I have a program running, when I press Alt+Ctrl+Del, I see its name "ABCD".
It is running in the background, I wanna FORCE the program "ABCD" to exit.
How do I do that?
Thanks.
Printable View
Hi...
Let's say I have a program running, when I press Alt+Ctrl+Del, I see its name "ABCD".
It is running in the background, I wanna FORCE the program "ABCD" to exit.
How do I do that?
Thanks.
Here's a good example on how to list all the applications running in a listbox and than kill them.
App List and Kill
Send the WM_CLOSE message with the DestroyWindow function. This example will close Calculator.
Code:Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
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 Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
Const WM_CLOSE = &H10
Private Sub Command1_Click()
Dim hApp As Long
hApp = FindWindow(vbNullString, "Calculator")
Call SendMessage(hApp, WM_CLOSE, 0, 0)
Call DestroyWindow(hApp)
End Sub
Thank u, Megatron.
Worked.