标签:ror 创建 cti err color seh ESS 失败 tla
可以用互斥量作为单实例应用控制,
如:
进程A创建互斥量Mutex,
启动进程B创建互斥量Mutex失败,这时候就不打开进程B而是打开进程A
HANDLE hMutex = ::CreateMutexW(NULL, FALSE, ptr);
if (hMutex == NULL)
{
std::cout << "create mutex error with." << GetLastError() << std::endl;
}
else {
std::cout << "create mutex successful." << std::endl;
}
if (ERROR_ALREADY_EXISTS == GetLastError())
{
cout << "mutex has exists" << endl;
}
else
{
cout << "create new muetex" << endl;
}
//记得创建完后释放互斥量.
CloseHandle(hMutex);
标签:ror 创建 cti err color seh ESS 失败 tla
原文地址:https://www.cnblogs.com/liuruoqian/p/12979863.html