david749
asked on
Preventing multiple instances of a VB EXE from running?
I have a VB app that is delivered in the form of an EXE file. I must prevent the user from running multiple instances of this program. How do I do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Obviously only the "If App.PrevInstance = True Then" part is relevant :)
Here's a nice link to a way of launching the app that is already running.
http://vbcode.com/asp/showsn.asp?theID=574
http://vbcode.com/asp/showsn.asp?theID=574
One way to do it is adding a module to your project, create a sub Main procedure and:
Sub Main
If app.previnstance then
end
else
frmMain.show
end if
End Sub
Don't forget to swith your start object to the sub main routine going to Project properties menu.
Sub Main
If app.previnstance then
end
else
frmMain.show
end if
End Sub
Don't forget to swith your start object to the sub main routine going to Project properties menu.