Prevent multiple copies running

Is there a way to prevent the user from starting more than one copy of my program?  It's an "In-House" app, and night shift likes to start enough instances to run out of memory and take a break.
WSRAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcriderCommented:
HOWTO: Prevent Multiple Instances of a 32-bit VB Application
0
KDivadCommented:
First line of code in your app:

If App.PrevInstance Then End
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mcriderCommented:
Missed pasting URL, Here it is...


HOWTO: Prevent Multiple Instances of a 32-bit VB Application
http://support.microsoft.com/support/kb/articles/Q185/7/30.ASP

 
 Cheers!
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

caraf_gCommented:
KDivad's suggestion is the correct one and it was mentioned first, so KDivad should get the points.
0
mcriderCommented:
caraf_g,

From: KDivad
 Date: Friday, October 29 1999 - 08:27AM EDT  
From: mcrider
 Date: Friday, October 29 1999 - 08:27AM EDT

Notice anything?
0
JuiletteCommented:
Shark Attack! These points make people crazy. Here's the code....maybe you should flip a coin between the two seeing as they have same times posted...
Really....

' See if there is already and instance.
    If App.PrevInstance Then
        ' Activate the previous instance
        AppActivate App.Title
       
        ' Send a key (here SHIFT-key) to set the
        ' form from the previous instance to the
        ' top of the screen.
        SendKeys "+", True
       
        ' Terminate the new instance
        Unload Me
    End If


0
KDivadCommented:
Give the points to mcrider. He/She DID post first, even though the link was missing and I couldn't care any less about the points.
0
WSRAuthor Commented:
First answer was my question.  Second answer, as a comment, was posted after KDivad's comment.  I tried KDivad's solution and it worked.  Microsoft's code was more complete, but for in-house use, KISS is better.  Thanks everybody!
0
KDivadCommented:
You're Welcome!
Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.