CreateMutex(NULL,TRUE,_T("PreventSecondInstance"))//有什么具体含义吗?
- C/C++ code
bool bFound = false;m_hMutexOneInstantance=CreateMutex(NULL,TRUE,_T("PreventSecondInstance"));if(GetLastError()==ERROR_ALREADY_EXISTS) bFound=TRUE;if(m_hMutexOneInstantance) ReleaseMutex(m_hMutexOneInstantance);if (bFound==TRUE){ ::AfxMessageBox("已经有一个程序在运行"); return false;}[解决办法]