-
Any one know how to end task\kill\close\etc. a program. For say I make up a program that creates a icon in the system tray but I don't want the program to "end" it self. I want to make anouther program to end task the system tray icon program. Kind of like the Ctrl-Alt-Delete taskman.exe program. Where you "end task" (I know there is a differecne between end task and close.) a program.
-
Hi
You nedd to declare these functions / constents
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 Const WM_CLOSE = &H10
Private Sub Command1_Click()
Dim Whnd&, Ret&
Whnd = FindWindow(vbNullString, "Solitaire")
If Whnd <> 0 Then
Ret = SendMessage(Whnd, WM_CLOSE, 0&, 0& )
End If
End Sub
'The above example will close Solitaire game if is running
HTH
Geoff
[Edited by Geoff Gunson on 04-18-2000 at 12:03 PM]
-
Thanks