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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing Existing Instance

Status
Not open for further replies.

stathread

Programmer
Jan 17, 2006
38
US
I built an application which runs in the system tray. If I forget its running and click the exe it opens another instance. Is there a way to check to see if there is already one running on the local machine?

Thanks
 
Another technique which is even easier is to attempt to create a named Mutex:
Code:
bool wasCreated;
Mutex myMutex = new Mutex(false, "some long and difficult to copy name", out wasCreated);
if (wasCreated)
{
   // Run app normally
}
Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top