VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

DetectPreviousInstance

VB FAQ  (6 Submissions)   Windows System Services   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

How do I prevent multiple instances of my program? In VB 3 and above, the property App.PrevInstance is set to True if an older instance of the program already exist.

Assumes
As Robert Knienider([email protected]) informed me, this piece of code will not work for non-English versions of Mirosoft Windows where the word for "Restore" does not have "R" as the underlined word. Replace the "R" in the SendKeys line above with "{ENTER}" or "~". Note that you shouldn't prevent multiple instances of your application unless you have a good reason to do so, since this is a very useful feature in MS Windows. Windows will only load the code and dynamic link code once, so it (normally) uses much less memory for the later instances than the first.

Rate DetectPreviousInstance (4(4 Vote))
DetectPreviousInstance.bas

DetectPreviousInstance Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters