首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

在MainFrame中如何调用Onclose()

2012-05-20 
在MainFrame中怎么调用Onclose()按书上一个样例程序,在MainFrame中写了个Onclose(),退出时,会弹出对话框

在MainFrame中怎么调用Onclose();
按书上一个样例程序,在MainFrame中写了个Onclose(),退出时,会弹出对话框问是不是关,但怎么点右上角的X,也不出现,似乎没用调用到自己写的Onclose(),怎么回事?
void CMainFrame::OnClose()
{
if (AfxMessageBox("Do you really want to exit?",MB_YESNO)==IDYES)
{

CMDIFrameWnd::OnClose();



}

[解决办法]
你看一下你程序中下面这些都有没有:
1、在MainFrm.h中定义函数:afx_msg void OnClose();
2、在MainFrm.cpp中添加消息:ON_WM_CLOSE()
  

[解决办法]
onclose是对话框 , ondestroy吧
[解决办法]

探讨
onclose是对话框 , ondestroy吧

[解决办法]
右上角的X是系统命令。

热点排行