用VC MFC 编写的对话框程序,在对话框间切换时内存每次都增加,比如Cdilg  Ca;
Ca.Domodel();
Cdialog:onok();最后内存泄露,程序崩溃. 请问有什么好的解决办法吗.

解决方案 »

  1.   

    刚创建完对话框你调用Cdialog:onok();它干什么?
      

  2.   

    ULONG Thread()
    {
        Cdilg  Ca; 
        Ca.Domodel(); 
    }
    不就行了嘛。
      

  3.   

    对话框Cdilg里有东西没删干净
      

  4.   

    我建了一个基于对话框的空工程,只有两个对话框A  B
    我从A进入B或从B进入A时要求关闭当前的对话框
    从A进入B的代码:
    this->OnOK();
    B kb;
    kb.DoModal();从B进入A的代码:
    this->OnOK();
    A ka;
    ka.DoModal();切换时内存每次都增加,最后内存泄露,程序崩溃. 请问有什么好的解决办法吗
      

  5.   

    对话框变量要定义为全局的 怎么定义呢,我定义在b.h 头文件中会报错h:\vc-test\123\b.h(21) : error C2146: syntax error : missing ';' before identifier 'kb'
    h:\vc-test\123\b.h(21) : error C2501: 'CMy123Dlg' : missing storage-class or type specifiers
    h:\vc-test\123\b.h(21) : error C2501: 'kb' : missing storage-class or type specifiers#include "123Dlg.h"#if !defined(AFX_B_H__D85C11EB_3B28_4985_BA95_D061276F1322__INCLUDED_)
    #define AFX_B_H__D85C11EB_3B28_4985_BA95_D061276F1322__INCLUDED_#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    // B.h : header file
    ///////////////////////////////////////////////////////////////////////////////
    // B dialogclass B : public CDialog
    {
    // Construction
    public:
    B(CWnd* pParent = NULL);   // standard constructor

    CMy123Dlg kb;