Processes using System.Diagnostics Namespace

I want to use the system.diagnostics namespace to see if in instance of an application is already running from within my VB.NET app. How do I query the task manager to see if it is already running I thought I had seen something similar in a recent issue of MSDN, but I can't find that article/back issue for love nor money. Any assistance/direction would be greatly appreciated.

Thanks!




Answer this question

Processes using System.Diagnostics Namespace

  • Koltron

    This did the trick! Thanks!

    You rock!



  • StriderIRL

    If your goal is to prevent multiple runs of your program at the same time, you can use the framework (application settings) or create a mutex.

    See this thread for more info: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=153674&SiteID=1


  • K. Murli Krishna

    In order to determine if a process whose name you know is already running you can use the GetProcessesByName() method ala:

    Dim processes() As System.Diagnostics.Process = System.Diagnostics.Process.GetProcessesByName("iexplore")

    For Each p As System.Diagnostics.Process In processes

    Console.WriteLine(p.ProcessName + " is running with id# " + p.Id.ToString())

    Next

    Does this work for you



  • Processes using System.Diagnostics Namespace