4 个解决方案
#1
OnDestory() 或者自己拦截消息PreTranslateMessage
#2
OnClose()
#3
可否说的具体点啊?因为我尝试了,这两个都不可以了!
#4
void CProperty5Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
if(nID==SC_CLOSE)
{
if(AfxMessageBox("您确定要退出系统吗?",MB_OKCANCEL)==IDCANCEL)
{
return;
}
//sndPlaySound("sound\\close.wav",SND_NOSTOP);//SND_ASYNC
}
//SetSound(MAKEINTRESOURCE(IDR_WAVE1), ::GetModuleHandle(NULL), TRUE, FALSE);
//AfxGetApp()->m_pMainWnd->ShowWindow(SW_HIDE);
//SC_Maximize SC_CLOSE SC_MINIMIZE
CDialog::OnSysCommand(nID, lParam);
}
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
if(nID==SC_CLOSE)
{
if(AfxMessageBox("您确定要退出系统吗?",MB_OKCANCEL)==IDCANCEL)
{
return;
}
//sndPlaySound("sound\\close.wav",SND_NOSTOP);//SND_ASYNC
}
//SetSound(MAKEINTRESOURCE(IDR_WAVE1), ::GetModuleHandle(NULL), TRUE, FALSE);
//AfxGetApp()->m_pMainWnd->ShowWindow(SW_HIDE);
//SC_Maximize SC_CLOSE SC_MINIMIZE
CDialog::OnSysCommand(nID, lParam);
}
#1
OnDestory() 或者自己拦截消息PreTranslateMessage
#2
OnClose()
#3
可否说的具体点啊?因为我尝试了,这两个都不可以了!
#4
void CProperty5Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
if(nID==SC_CLOSE)
{
if(AfxMessageBox("您确定要退出系统吗?",MB_OKCANCEL)==IDCANCEL)
{
return;
}
//sndPlaySound("sound\\close.wav",SND_NOSTOP);//SND_ASYNC
}
//SetSound(MAKEINTRESOURCE(IDR_WAVE1), ::GetModuleHandle(NULL), TRUE, FALSE);
//AfxGetApp()->m_pMainWnd->ShowWindow(SW_HIDE);
//SC_Maximize SC_CLOSE SC_MINIMIZE
CDialog::OnSysCommand(nID, lParam);
}
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
if(nID==SC_CLOSE)
{
if(AfxMessageBox("您确定要退出系统吗?",MB_OKCANCEL)==IDCANCEL)
{
return;
}
//sndPlaySound("sound\\close.wav",SND_NOSTOP);//SND_ASYNC
}
//SetSound(MAKEINTRESOURCE(IDR_WAVE1), ::GetModuleHandle(NULL), TRUE, FALSE);
//AfxGetApp()->m_pMainWnd->ShowWindow(SW_HIDE);
//SC_Maximize SC_CLOSE SC_MINIMIZE
CDialog::OnSysCommand(nID, lParam);
}