#pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")
HANDLE hMutex = CreateMutexA(NULL, true, "XXX_0D0DDD11-5E3F-4287-BB74-7E3D2C7720EF");
if (hMutex)
{
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
//std::cerr << "Program already run...\n"
// << "Press any key to exit..." << std::endl;
//std::cin.get();
return 1;
}
}
else
{
return 1;
}
转载于:https://www.cnblogs.com/wjchang/p/3671665.html