|
-
Nov 2nd, 2000, 04:56 PM
#1
Thread Starter
Member
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
-
Nov 2nd, 2000, 05:44 PM
#2
Lively Member
Here it is..
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
-
Nov 3rd, 2000, 03:29 AM
#3
Thread Starter
Member
It isn´t so easy
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!
-
Nov 3rd, 2000, 07:06 AM
#4
Thread Starter
Member
-
Nov 3rd, 2000, 07:14 AM
#5
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
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
|