BOOL MyApp::InitInstance()
{
::CreateMutex(NULL,TRUE,m_pszExeName);
if(GetLastError()==ERROR_ALREADY_EXISTS)
{
AfxMessageBox("该程序已经运行!");
exit(0);
}
...............
}
{
::CreateMutex(NULL,TRUE,m_pszExeName);
if(GetLastError()==ERROR_ALREADY_EXISTS)
{
AfxMessageBox("该程序已经运行!");
exit(0);
}
...............
}