Results 1 to 4 of 4

Thread: Terminate a Process

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2001
    Location
    Viet Nam
    Posts
    98

    Terminate a Process

    Can anyone tell me how to find a process ID and terminate it?

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    GetCurrentProcessId and the GetCurrentProcess API's. Then use the TerminateProcess API to terminate it.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Declare Function TerminateProcess Lib "kernel32" Alias "TerminateProcess" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long

    · hProcess
    Identifies the process to terminate.
    Windows NT: The handle must have PROCESS_TERMINATE access. For more information, see Process Objects.

    · uExitCode
    Specifies the exit code for the process and for all threads terminated as a result of this call. Use the GetExitCodeProcess function to retrieve the process’s exit value. Use the GetExitCodeThread function to retrieve a thread’s exit value.


    Declare Function GetCurrentProcessId Lib "kernel32" Alias "GetCurrentProcessId" () As Long

    Declare Function GetCurrentProcess Lib "kernel32" Alias "GetCurrentProcess" () As Long
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2001
    Location
    Viet Nam
    Posts
    98
    But I dont want to terminate the current Process. For example, I run Vb application. In this application, I open Excel . The current process is my Application but I want to Terminate Excel.

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