I want to kill a task only with one click on a button!
i have created a form with a command button.
it should kill task "project1"
What can i do???
Help plz
P.S. win98 system
Printable View
I want to kill a task only with one click on a button!
i have created a form with a command button.
it should kill task "project1"
What can i do???
Help plz
P.S. win98 system
It's simple just use this code to kill...
Kill "C:\FolderName\Project1.vbp"
But here is a RESTRICTION on this CODE.This kills only files on the disk not HUMAN BEINGS....
Just kidding.....
Regards
The app who is running is namend "screenlock.exe" but in my taskmanager it appears at "project1".
Now i want to kill the task not the whole file!
Come on Boys...........:):):):):):):)
You can close an application either by knowing it's class or caption.
Code:Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" _
Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As _
Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const WM_CLOSE = &H10
Const WM_DESTROY = &H2
Private Sub Command1_Click()
'Find the hWnd of the program
hWin = FindWindow("project1", "Caption")
'FindWindow(Class, Caption)
'If found then...
If hWin <> 0 Then 'close it
PostMessage hWin, WM_CLOSE, 0, 0
PostMessage hWin, WM_DESTROY, 0, 0
End If
'Closed
End Sub