for windows specific check, here is how u do it:
bool URCLASS::alreadyExists(wchar_t * appFileName)
{
/// Create mutex named for the current exe and check for its existence
bool bResult = false;
// Don't separate these next two statements; GetLastError()
// must be the first call after the CreateMutex() call
hMutex = ::CreateMutex(NULL, TRUE, appFileName);
DWORD dwLastError = ::GetLastError();
// If the mutex already exists, return true to indicate that this exe
// is already running.
if (dwLastError == ERROR_ALREADY_EXISTS)
{
bResult = true;
}
return bResult;
}
bool URCLASS::alreadyExists(wchar_t * appFileName)
{
/// Create mutex named for the current exe and check for its existence
bool bResult = false;
// Don't separate these next two statements; GetLastError()
// must be the first call after the CreateMutex() call
hMutex = ::CreateMutex(NULL, TRUE, appFileName);
DWORD dwLastError = ::GetLastError();
// If the mutex already exists, return true to indicate that this exe
// is already running.
if (dwLastError == ERROR_ALREADY_EXISTS)
{
bResult = true;
}
return bResult;
}
To copy to clipboard, switch view to plain text mode
is that what u need?
Bookmarks