-
August 3rd, 2015, 03:58 AM
#1
Run multiple instances of app's designed for single instance in C++ ?
Hello
I have an application with a mutex that prevent it from being opened more than once.
Code:
HANDLE h = CreateMutex(NULL, FALSE, "uniqyeidclaxemain");
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
MessageBox(NULL, "An instance is already running.", "Already running", MB_ICONERROR | MB_OK);
return 0;
}
If i try to open it again, an error appears that app is already running.
I'm looking for a way to CreateProcess multiple instances of this kind of programs. Is there any tweak in windows to allow opening single instances app from my own exe ? I'm thinking about creating processes with different process names, classes or even hooking the NTQuery but still the mutex is there.
Any help regarding this would be greatly appreciated!
Thank you
Last edited by eclessiastes; April 7th, 2017 at 06:43 PM.
-
August 3rd, 2015, 07:09 AM
#2
Re: Run multiple instances of app's designed for single instance in C++ ?
allow a commandline parameter, and concatenate that parameter to the mutexname.
you can then have as many instances as you want, but only if you provide unique parameters.
-
August 3rd, 2015, 09:35 AM
#3
Re: Run multiple instances of app's designed for single instance in C++ ?
Why do the exes that you are trying to open limit to a single instance? Unless you have access to the code, can you be sure?
It could be that opening multiple instance of the program will corrupt resources (files, internal databases, etc.) if a program hasn't be designed to be multi-instance.
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
|