Results 1 to 3 of 3

Thread: [RESOLVED] Process is running.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Location
    Denmark
    Posts
    67

    Resolved [RESOLVED] Process is running.

    how do i check if a process is running, im making a program that starts "notepad" etc, if it aint allready open...

    something like, if process("notepad") running then
    ----
    else

    run notepad

    kinda thing

  2. #2
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Process is running.

    The correct namespace is: System.Diagnostics.Process
    VB Code:
    1. private void IsNotePadRunning()
    2. {
    3.     System.Diagnostics.Process[] pro = System.Diagnostics.Process.GetProcessesByName("notepad");
    4.     if (pro.GetLength(0) > 0)
    5.     {
    6.         //do your work here
    7.     }
    8.     else
    9.     {
    10.         System.Diagnostics.Process.Start("notepad.exe");
    11.     }
    12. }
    Show Appreciation. Rate Posts.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2006
    Location
    Denmark
    Posts
    67

    Re: Process is running.

    It works perfect thx dude

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