• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

Check for app already running

I need my app to check all currently running processes (at app startup) to make sure it isn't already running; and if so, cancel the 2nd run of said app. Can/How do I do that?
1 Solution
Here is one easy way:

Option Explicit

'Add the following code to a Standard Module
'From the menu Project->Project Properties->[Startup Object] select "Sub Main"

Sub Main()
    If Not (App.PrevInstance) Then
        frmMain.Show '<< modify to point to your main form
    Else '<<optional
        MsgBox App.EXEName & " is already running", vbInformation Or vbOKOnly, App.Title
    End If
End Sub
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now