VC6.0编写的对话框无法关闭

VC6.0编写的对话框无法关闭,第1张

在这里,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


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/13380340.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-07-25
下一篇 2023-07-25

发表评论

登录后才能评论

评论列表(0条)

保存