// //只能运行一个实例 HANDLE hMutexOneInstantance=CreateMutex(NULL,TRUE,_T("PreventSecondInstance")); BOOL bFound=FALSE; if(GetLastError()==ERROR_ALREADY_EXISTS) bFound=TRUE; if(hMutexOneInstantance) ReleaseMutex(hMutexOneInstantance); if (bFound==TRUE) { //::AfxMessageBox("您已经运行了一个实例"); return false; }