第一个问题在MSDN里讲得很清楚了CObject::Dump 
virtual void Dump( CDumpContext& dc ) const;ParametersdcThe diagnostic dump context for dumping, usually afxDump.ResDumps the contents of your object to a CDumpContext object. When you write your own class, you should override the Dump function to provide diagnostic services for yourself and other users of your class. The overridden Dump usually calls the Dump function of its base class before printing data members unique to the derived class. CObject::Dump prints the class name if your class uses the IMPLEMENT_DYNAMIC or IMPLEMENT_SERIAL macro.Note   Your Dump function should not print a newline character at the end of its output. Dump calls make sense only in the Debug version of the Microsoft Foundation Class Library. You should bracket calls, function declarations, and function implementations with #ifdef _DEBUG/#endif statements for conditional compilation. Since Dump is a const function, you are not permitted to change the object state during the dump. The CDumpContext insertion (<<) operator calls Dump when a CObject pointer is inserted. Dump permits only “acyclic” dumping of objects. You can dump a list of objects, for example, but if one of the objects is the list itself, you will eventually overflow the stack.ExampleSee CObList::CObList for a listing of the CAge class used in all CObject examples.// example for CObject::Dump
void CAge::Dump( CDumpContext &dc ) const
 {
 CObject::Dump( dc );
 dc << "Age = " << m_years;
 }

解决方案 »

  1.   

    DECLARE_DYNCREATE 该宏用来动态生成,即在程序执行期间根据动态获得一个类名来生成一个对象;例如你的程序要从磁盘读档,事先程序不知道下一步读进内存的是什么对象,此时通过动态生成即可知道。
      

  2.   

    但是我重载了dump后,我增加的dump信息为什么不能显示,
      

  3.   

    1.Dump( CDumpContext& dc ) 可显示对象DC的内存2 运行时动态创建对象即程序运行时需要创建的对象,如MDI窗体,用户需要自动创建的对话框等
    class CMainFrame : public CFrameWnd
    {

    protected: // create from serialization only
    CMainFrame();
    DECLARE_DYNCREATE(CMainFrame)// Attributes
    public:// Operations
    public:// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CMainFrame)
    virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
    //}}AFX_VIRTUAL// Implementation
    public:
    virtual ~CMainFrame();
    #ifdef _DEBUG
    virtual void AssertValid() const;
    virtual void Dump(CDumpContext& dc) const;
    #endifprotected:  // control bar embedded members
    CStatusBar  m_wndStatusBar;
    CToolBar    m_wndToolBar;// Generated message map functions
    protected:
    //{{AFX_MSG(CMainFrame)
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    // NOTE - the ClassWizard will add and remove member functions here.
    //    DO NOT EDIT what you see in these blocks of generated code!
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    };