Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I stop a program from running twice?

Status
Not open for further replies.

Adric

Programmer
Jun 25, 2001
24
US
I am writing an auto run program for a cd I am making. When I put the cd in the drive, the program loads twice. Is there any code I can use to stop the program from loading if it is already running?
 
Hi,

The App.PrevInstance returns a value to indicate if the program is already running.

Madlarry
 
So i would write
if app.PrevInstance=True then
unload me
end if
 
Sorry I should have made that a bit clearer.

If you check out the following article in MSDN, it gives more comprehensive details:

Q142937 : How to Prevent Multiple Instances of a VB Application

Madlarry
 
I don't have msdn. I was given the disc by my professor at a college one year ago and it was not included.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top