0
点赞
收藏
分享

微信扫一扫

CreateMutex GetLastError防止多个实例运行


else
	{
		// TODO: code your application's behavior here.
		/*
		CString strHello;
		strHello.LoadString(IDS_HELLO);
		cout << (LPCTSTR)strHello << endl;
		//*/
		HANDLE h=CreateMutex(NULL,FALSE,"my13871234567");
		if(GetLastError()==ERROR_ALREADY_EXISTS)
		{
			cout<<"GetLast!"<<endl;
			goto endapp;
		}
		else
		{
			cout<<"First!"<<endl;
			getchar();
		}
	}
endapp:
	return nRetCode;
}



举报

相关推荐

0 条评论