|
-
Jun 11th, 2004, 01:50 AM
#1
Thread Starter
Addicted Member
another instance of program is running?
How to catch if another instance of the program is running?
-
Jun 11th, 2004, 02:57 AM
#2
The usual way in Win32 is to have the program create a named global semaphore/mutex/whatever first thing. They can be queried for. If it already exists, the app is already running.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jun 11th, 2004, 12:15 PM
#3
Frenzied Member
Here is an example:
Code:
HANDLE g_hMutex;
//Create A Mutex
g_hMutex = CreateMutex( NULL, TRUE, "Program Name"); //Create A Mutex To Keep The Program From Running More Than Once
if (g_hMutex && (GetLastError() == ERROR_ALREADY_EXISTS ))
return 0;
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Jun 13th, 2004, 11:59 PM
#4
Thread Starter
Addicted Member
another instance of program is running?
-
Jun 14th, 2004, 12:21 AM
#5
If the problem is that you don't want more then one instance of your app to run. Then you should google on Singelton classes. It's a verey common way to just make one instance of an app run.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|