在点击x退出时,弹出确认对话框,选择取消的话就不退出

解决方案 »

  1.   

    我在MainFrame里面处理这个消息,不过没有用啊
      

  2.   

    在OnClose()里处理:
    if(MessageBox("\r\n确定退出吗?   \r\n"," 退出 ",MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2)==IDNO)
    {
      return;
    }
      

  3.   

    void CMainFrame::OnClose() 
    {
    // TODO: Add your message handler code here and/or call default
    if (AfxMessageBox("Close?",MB_YESNO|MB_ICONQUESTION) == IDYES)
        CFrameWnd::OnClose();
    }