BOOL CAddressAssistApp::InitInstance()
{
hMutex = CreateMutex(NULL, FALSE, "端口助手");
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
AfxMessageBox("对不起,已有一程序在运行!", MB_OK);
return FALSE;
}
IsInitializeWinIo = InitializeWinIo();
if(!IsInitializeWinIo)
{
AfxMessageBox("加载Winio驱动错误!");
return FALSE;
}
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CAddressAssistDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
int CAddressAssistApp::ExitInstance()
{
// TODO: Add your specialized code here and/or call the base class
ReleaseMutex(hMutex);
if(IsInitializeWinIo)
{
ShutdownWinIo();
}
return CWinApp::ExitInstance();
}
文章评论(0条评论)
登录后参与讨论