退出对话框时要处理一些事情,比如delete[]用new分配的地址空间等,在哪里添加代码?我的对话框是new,然后再create出来的:
DatabaseBackupDlg *db=new DatabaseBackupDlg;
db->Create(IDD_DIALOG_SQLBackup,NULL);
db->ShowWindow(SW_SHOW);
DatabaseBackupDlg *db=new DatabaseBackupDlg;
db->Create(IDD_DIALOG_SQLBackup,NULL);
db->ShowWindow(SW_SHOW);
解决方案 »
- 如何读别人留下的代码
- INDOWS.H already included
- WM_PAINT与WM_ERASEBKGND的关系
- 大家看看这个问题如何解决,谢谢!
- 如何在activemovie控件上画图
- FTP服务器文件图标问题,详情见内.
- 高分求解!!!如何用VToolsD编程实现拦截WinMe下的进程查询函数?在线等待中......
- VC 窗口标题栏重绘。
- 大菜鸟的问题:我就是不信---有几万VC编程者的CSDN就没有人给出解决这个问题的建议?
- 请问MFC的datagrid控件 表里面数据显示的顺序怎么改呢
- 编程获取域用户的登录脚本
- 一个DLL程序即有WinMain函数又有DLLMain函数是怎么回事?
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.
对于数据的东西在析构函数中处理即可
如果涉及到控件建议放到DestroyWindow中
按2楼说的
如果要销毁自己就在PostNcDestro中delete this