随笔 - 3  文章 - 3  trackbacks - 0
<2008年6月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

常用链接

留言簿(1)

随笔分类

随笔档案

相册

News

Program

搜索

  •  

最新评论

阅读排行榜

评论排行榜

         When you implement a modeless dialog box, always override the OnCancel member function and call DestroyWindow from within   it. Don’t call the base class CDialog::OnCancel, because it calls EndDialog, which will make the dialog box invisible but will not destroy it. 
         You should also override PostNcDestroy for modeless dialog boxes in order to delete this, since modeless dialog boxes are usually allocated with new. Modal dialog boxes are usually constructed on the frame and do not need PostNcDestroy cleanup.
posted on 2008-04-14 10:19 陈振辉 阅读(842) 评论(3)  编辑 收藏 引用 所属分类: MFC

FeedBack:
# re: Destroy modeless dialog box 2008-08-10 23:28 企业即时通讯
说什么来了?我怎么销毁呢?New 了之后?。  回复  更多评论
  
# re: Destroy modeless dialog box 2008-08-10 23:32 企业即时通讯
看第二遍终于明白了。  回复  更多评论
  
# re: Destroy modeless dialog box[未登录] 2011-08-11 11:06 eric
DestroyWindow invalidates the window handle to the dialog box, so any subsequent calls to functions that use the handle return error values. To prevent errors, the dialog box procedure should notify the owner that the dialog box has been destroyed. Many applications maintain a global variable containing the handle to the dialog box. When the dialog box procedure destroys the dialog box, it also sets the global variable to NULL, indicating that the dialog box is no longer valid.

The dialog box procedure must not call the EndDialog function to destroy a modeless dialog box.
  回复  更多评论
  

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理