bool ProcessHelper::IsRunningAlready(const std::string& processName)
{
HANDLE tempMutex = CreateMutexA(NULL, TRUE, processName.c_str());
DWORD dwRet = GetLastError();
if (tempMutex)
{
if (ERROR_ALREADY_EXISTS == dwRet)
{
//MessageBoxA(nullptr, "程序已经在运行中了!", "警告", MB_OK);
CloseHandle(tempMutex);
return true;
}
}
return false;
}