Results 1 to 5 of 5

Thread: Kill Task??

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    51

    Question

    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

  2. #2
    Lively Member
    Join Date
    Oct 2000
    Location
    Chicago
    Posts
    97

    Talking 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
    Anil

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    51

    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!


  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    51

    !!!

    Come on Boys...........

  5. #5
    Guest
    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
  •  



Click Here to Expand Forum to Full Width