Results 1 to 4 of 4

Thread: [RESOLVED] [2005] Stop a Process?--HELP

  1. #1

    Thread Starter
    Hyperactive Member sheikh78's Avatar
    Join Date
    Apr 2006
    Location
    C:/
    Posts
    423

    Resolved [RESOLVED] [2005] Stop a Process?--HELP

    Does anybody know how to stop a process? I have the process id and everything i just need to know the code to stop it. Thanks!

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,439

    Re: [2005] Stop a Process?--HELP

    This is for a Windows app:
    VB Code:
    1. Dim proc As Process = Process.GetProcessById(pid)
    2.  
    3.         proc.CloseMainWindow() 'This is equivalent to clicking the Close button on the title bar.
    4.         proc.WaitForExit(5000) 'Give the app up to 5 seconds to exit gracefully.
    5.  
    6.         If Not proc.HasExited Then
    7.             proc.Kill() 'Force the app to exit.
    8.         End If
    If the app has no GUI then just go straight to Kill. If the process is a Windows service then you would use a ServiceController to stop the service instead.

  3. #3

    Thread Starter
    Hyperactive Member sheikh78's Avatar
    Join Date
    Apr 2006
    Location
    C:/
    Posts
    423

    Re: [2005] Stop a Process?--HELP

    Thanks.

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,439

    Re: [2005] Stop a Process?--HELP

    Don't forget to resolve your thread from the Thread Tools menu.

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