none
How to find my VB application is already running

Answers

All replies

  • You can use GetProcessesByName() to find this information.
     
            For Each p As Process In Process.GetProcessesByName("myapp")  
                MsgBox(p.ToString)  
            Next 

    Here "myapp" is the name of the application.
    • Proposed as answer by Davester Wednesday, July 23, 2008 1:12 AM
    • Marked as answer by Martin Xie - MSFT Saturday, July 26, 2008 5:38 AM
    Monday, July 21, 2008 1:11 PM
  • The bigger question is why do you want to know if your application is already running. Typically you check for this to make sure you have one instance running. If there is already a running version, then call back into the existing instance. If that is what you are trying to accomplish and you are using 2005+, you may want to consider looking into the "Make single instance application" application setting which handles most of the plumbing around this for you (and works in a terminal services environment as well).

    Jim Wooley
    www.ThinqLinq.com
    http://www.LinqInAction.net - "LINQ In Action", The book is now available. Don't wait for the movie
    Tuesday, July 22, 2008 8:36 PM
  • How to include Getprocessbyname?   (say dll or ocx or how)
    Wednesday, July 23, 2008 7:25 AM
  • You need to import the Diagnostics namespace.

    Imports System.Diagnostics 
    Wednesday, July 23, 2008 8:56 AM
  • Hi,

    I am using VB6

    Ho to do?

    A. Murugesan
    Wednesday, July 30, 2008 12:05 PM
    • Marked as answer by kgmmurugesh Tuesday, February 03, 2009 6:36 AM
    Wednesday, July 30, 2008 12:08 PM