to create single instance of application at any time
this code helps to run only one instance of application
//just create mutex with valid name in InitInstance () method of MFC application
HANDLE hmutex = CreateMutex(NULL,FALSE,"JUSTTOCHECK");
// then check for that name whether it already exists or not by following code,
// if exists release mutex and return false otherwise just release the mutex
{
if ( hmutex && GetLastError () == ERROR_ALREADY_EXISTS)
ReleaseMutex (hmutex);
return FALSE;
}
ReleaseMutex (hmutex) ;
when you run the application it opens the window, keeping that open if you try to run the same application it won't
creates window.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here