How to Check whether the application/process is running or not by passing the process name

Here is the awesome VB.Net code to check whether the application/process is running or not by passing the process name:

Module modMain
  Sub Main()
    'Check whether acrobat is running or not
    If IsProcessRunning("acrobat") Then
      Console.WriteLine("Yes. Acrobat is running")
    Else
      Console.WriteLine("No. Acrobat is not running")
    End If
  End Sub
  Private Function IsProcessRunning(ByVal sProcess As String) As Boolean
    For Each oProc As Process In Process.GetProcessesByName(sProcess)
      Return True
    Next
  End Function
End Module

Project Type: Console
Language: VB.Net
Tested with: VS 2008

Incoming search terms:

This entry was posted in System & API, VB.Net and tagged application running, c#.net .Net, How to, How to check application running, VB.Net, vb.net code. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>