• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 181
  • 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?
0
RunBoris
Asked:
RunBoris
1 Solution
 
Erick37Commented:
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
0
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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