Multiple instances

How do you keep a person from opening several instances
of a program? The previnstance wants an object as the
parameter, not an exe name....
WPentecostAsked:
Who is Participating?
 
dm_14Connect With a Mentor Commented:
1. Place the following code in your apps Sub Main () or form_load procedure

if App.PrevInstance then
 msgbox "App is already available"
 end
end if

2. Try to run two instances of your app, the above message will be displayed and the program will terminate.

This will prevent a person from running multiple instances of a program.
0
 
MikeP090797Commented:
IF the program is yours, you need to use the App object, App.PrevInstance
0
 
vmanoCommented:
if you want the EXE name to be passed in as a parameter, then try FindWindow and SetFocus API calls.

vmano


0
 
MikeP090797Commented:
didn't I already suggest that?
0
All Courses

From novice to tech pro — start learning today.