`
xusaomaiss
  • 浏览: 608404 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

warning :OnDestroy or PostNcDestroy in derived class will not be called

 
阅读更多

应用程序中使用指针创建了对话框,在析构函数中使用delete时,会出现以下警告:

Warning: calling DestroyWindow in CDialog::~CDialog --
OnDestroy or PostNcDestroy in derived class will not be called.

我们在释放指针的时候应该先通过对话框指针调用DestroyWindow()方法,然后再用delete删除。

CDlg::~CDlg()
{
 if(m_pDlg!= NULL)
 {
  m_pDlg->DestroyWindow();
  delete m_pDlg;
 }
}

只有这样才可以把这个警告给去掉

 

备注:

       接了两次外包,发现有些问题,决定不再接外包了,第一:它影响到我的正常上班,第二:因为都是私人或是小公司的外包,无法像大公司一样,把需求,功能说清楚,以致做一下停一下,又有新功能又做一些,周期太长,钱太少。特别说明,已经不再接外包,如果接的话,就是牵个线了。

 

 

分享到:
评论

相关推荐

    模态对话框与非模态对话的几种销毁方法与区别

     Warning:calling DestroyWindow in CWnd::~CWnd OnDestroy or PostNcDestroy in derived class will not be called  由于是Warnning,没有太在意,后来随意上网一找发现,这个问题还是很严重的问题。  后,...

    MFC中解决子线程中打开非模态对话框内存泄漏实例(VC++2008)

    重写对话框的PostNcDestroy OnClose OnDestroy 具体代码如下: void CMyDlg::PostNcDestroy { TODO: 在此添加专用代码和 或调用基类 delete this; CDialog::PostNcDestroy ; } void CMyDlg::OnClose { ...

    aaa.rar_OnDestroy_PreTranslateMessage_childview opengl_onsize_vi

    这是用MFC编写的使用openGL的视口代码。 CChildView::CChildView() 构造函数 CChildView::~CChildView() 析构函数 BEGIN_MESSAGE_MAP(CChildView,CWnd ) 消息映射 ...void CChildView::OnDestroy() 销毁窗口

    unigui0.83.5.820

    - UniDBGrid: _OnDataLoaded may be called before Grid is rendered - UniPageControl: TabIndex doesn't return correct index - UniComboBox in hidden TabPage bug in Chrome browser - UniApplication: New ...

    Vc++国家信息系统

    void CExmpListDlg::OnDestroy() { CDialog::OnDestroy(); for(int nIndex=m_ListBx.GetCount()-1;nIndex>=0;nIndex--) { delete(SState*)m_ListBx.GetItemDataPtr(nIndex); } // TODO: Add your ...

    类 SDK窗口程序

    OnDestroy ; break; default: return DefWindowProc hWnd message wParam lParam ; } return 0; }">这个程序采用了Thunk技术 来自看雪的一个牛人 这个技术用到标准的SDK创建窗口中 就可以在 回调函数中...

    MVP-VM实践

    protected fun <T : BaseViewModel> vmProviders(modelClass: Class): T { val viewModel: BaseViewModel if (mContext is FragmentActivity || mContext is Fragment) { viewModel = if (mContext is ...

    Android代码-android-disposebag

    Even if we could achieve this, there's still a problem with the Android platform, Activities are created and managed by the system, using it after either onDestroy or onStop method is called will ...

    OnOK OnCancel OnClose OnDestroy 详解

    OnOK OnCancel OnClose OnDestroy

    Android实验报告生命周期.doc

    public class AlifecycleActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ...

    Delphi7.1 Update

    visit the Borland Registered User web site to obtain a localized readme file that may contain important late- breaking information not included in this readme file.IMPORTANT: Delphi must be closed ...

    简易的播放器

    // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX ); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { ...

    简易图像处理软件

    CDialog::OnDestroy(); cvReleaseImage(&pImg;); cvReleaseImage(&wImg;); cvReleaseImage(&gImg;); cvDestroyAllWindows(); AfxGetMainWnd()->SendMessage(WM_CLOSE); } void CDIPDlg::OnGaos() { // ...

    总结OnOK()、OnCancel()、OnClose()、OnDestroy

    主要描述了OnOK()、OnCancel()、OnClose()、OnDestroy等几个函数的调用次序等。

    一本android的好书beginning android 2 和 源码

    onCreate() and onDestroy() onStart(), onRestart(), and onStop() onPause() and onResume() The Grace of State ■Chapter 17: Creating Intent Filters What’s Your Intent? Pieces of Intents Intent ...

    DevExpress VCL v2012 vol 1.6源码、例子、帮助

    Q440453 - TdxComponentPrinter - The Date And Time dialog cannot be re-opened after the last time format has been selected in the Available Time Formats list Q435027 - The Print Preview window freezes ...

    DevExpress VCL v2012 vol 1.6源码、例子、帮助-Part1

    Q440453 - TdxComponentPrinter - The Date And Time dialog cannot be re-opened after the last time format has been selected in the Available Time Formats list Q435027 - The Print Preview window freezes ...

    DevExpress VCL 2012 vol 1.6源码、例子、帮助-Part2

    Q440453 - TdxComponentPrinter - The Date And Time dialog cannot be re-opened after the last time format has been selected in the Available Time Formats list Q435027 - The Print Preview window freezes...

    DevExpress VCL v2012 vol 1.6源码、例子、帮助-part2

    Q440453 - TdxComponentPrinter - The Date And Time dialog cannot be re-opened after the last time format has been selected in the Available Time Formats list Q435027 - The Print Preview window freezes ...

    DevExpress VCL 2012 vol 1.6源码、例子、帮助-Part1

    Q440453 - TdxComponentPrinter - The Date And Time dialog cannot be re-opened after the last time format has been selected in the Available Time Formats list Q435027 - The Print Preview window freezes...

Global site tag (gtag.js) - Google Analytics