15,471
社区成员
发帖
与我相关
我的任务
分享
HANDLE hMutex;
DWORD dwErr;
hMutex = CreateMutex(
NULL, // no security descriptor
FALSE, // mutex not owned
"NameOfMutexObject"); // object name
if (hMutex == NULL)
printf("CreateMutex error: %d\n", GetLastError() );
else
if ( GetLastError() == ERROR_ALREADY_EXISTS )
printf("CreateMutex opened existing mutex\n");
else
printf("CreateMutex created new mutex\n");