VC6.0编写的对话框无法关闭
我知道把//CDialog::OnCancel();的//去掉后,“取消”按钮会不起作用,但没想到这个窗口无论是点击右上角的X号,或alt+F4也都关不了。难道这句代码除...
我知道把//CDialog::OnCancel();的//去掉后,“取消”按钮会不起作用,但没想到这个窗口无论是点击右上角的X号,或alt+F4也都关不了。难道这句代码除了影响“取消”按钮,还会影响那个X号?
展开
2个回答
展开全部
在这里,OnCancel()函数和其它的按钮响应函数不太一样,它本身是CDialog类的虚函数。在基于对话框的程序中,点击关闭按钮,按键 ALT + F4,都会调用此函数(可加断点调试查看),注释掉调用基类函数的代码自然会导致无法手动关闭对话框。
可以查阅MSDN:
CDialog::OnCancel
virtual void OnCancel( );
If you implement the Cancel button in a modeless dialog box, you must
override the OnCancel method and call DestroyWindow from within
it. Do not call the base-class method, because it calls EndDialog, which
makes the dialog box invisible but does not destroy it.
可以查阅MSDN:
CDialog::OnCancel
virtual void OnCancel( );
If you implement the Cancel button in a modeless dialog box, you must
override the OnCancel method and call DestroyWindow from within
it. Do not call the base-class method, because it calls EndDialog, which
makes the dialog box invisible but does not destroy it.
追问
OK
TableDI
2024-07-18 广告
2024-07-18 广告
`VLOOKUP` 匹配出错误的数据通常是由于以下几个原因:1. **查找值错误**:输入的查找值与数据源中的值不匹配,可能是因为拼写错误、大小写不一致或存在不可见的字符。2. **查找区域设置错误**:查找区域的首列必须包含要查找的值,且...
点击进入详情页
本回答由TableDI提供
展开全部
在基于对话框的程序中,点击关闭按钮,按键 ALT + F4,都会调用此函数(可加断点调试查看),注释掉调用基类函数的代码自然会导致无法手动关闭对话框。
可以查阅MSDN:
CDialog::OnCancel
virtual void OnCancel( );
If you implement the Cancel button in a modeless dialog box, you must override the OnCancel method and call DestroyWindow from within it. Do not call the base-class method, because it calls EndDialog, which makes the dialog box invisible but does not destroy it.
可以查阅MSDN:
CDialog::OnCancel
virtual void OnCancel( );
If you implement the Cancel button in a modeless dialog box, you must override the OnCancel method and call DestroyWindow from within it. Do not call the base-class method, because it calls EndDialog, which makes the dialog box invisible but does not destroy it.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询