Paste this following code in BOOL CYourProjectNameApp::InitInstance() function of you Aplliction.
CreateMutex(NULL,TRUE,"Sample");
// mutex will be automatically deleted when process ends.
BOOL bAlreadyRunning = (GetLastError() == ERROR_ALREADY_EXISTS);
if(bAlreadyRunning)
{
::MessageBox(NULL, "This Appliction is Already Running ", "Information",
MB_ICONINFORMATION|MB_OK|MB_DEFBUTTON1);
return 0;
}
No comments:
Post a Comment