1:最小化:
响应WM_SIZE
如:
void CFgghDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
if(nType==SIZE_MINIMIZED)
AfxMessageBox("SDFSF");
// TODO: Add your message handler code here
}
2:关闭按钮
响应DestroyWindow
如
BOOL CFgghDlg::DestroyWindow()
{
// TODO: Add your specialized code here and/or call the base class
AfxMessageBox("uouipp");
return CDialog::DestroyWindow();
}
用ClassWizard映射WM_CLOSE消息函数OnClose()
//MDI
void CMainFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
int ret = MessageBox("Hello", "Close", MB_YESNO);
if(ret == IDYES)
CMDIFrameWnd::OnClose();
}
//Dialog
void CTestDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
int ret = MessageBox("Hello", "Close", MB_YESNO);
if(ret == IDYES)
CDialog::OnClose();
}
如果是对话框可以重载OnOk,OnCancel函数,在其中加入
if(MessageBox("OK", "OKOK",MB_YESNO)!=IDYES)
return ;
。。。
即可以
int response = MessageBox("确定推出么?", "确定", MB_YESNO);
if(response == IDYES)
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
// TODO: Add your message handler code here and/or call default
if(nID==SC_CLOSE){
MessageBox("aa");
//
}
CMDIFrameWnd::OnSysCommand(nID, lParam);
}