Run only a single app

How can I make sure that there is only 1 copy of my program that is running?

i.e. If the user wants to run another copy of my program, the program will detect it and exit immediately.
LVL 1
leesssAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Erick37Connect With a Mentor Commented:
Put a Sub Main in Module code and set that procedure as the startup procedure:

Sub Main()
    If Not App.PrevInstance Then 'If no previous instance is running...
        Form1.Show 'Show your application
    End If 'Else do nothing
End Sub
0
 
leesssAuthor Commented:
Erick37,

Since you've provided the web page which has more info, I am giving you 20 pts instead of 15.

Thanks a lot
0
All Courses

From novice to tech pro — start learning today.