一段小代码:
//**********Hello.h***********
#pragma once
#include "afxwin.h"
class CMyApp :
 public CWinApp
{
public:
 CMyApp(void);
 ~CMyApp(void);
 virtual BOOL InitInstance();
};
class CMainWindow :
 public CFrameWnd
{
public:
 CMainWindow(void);
 ~CMainWindow(void);
protected:
 afx_msg void OnPaint();
 DECLARE_MESSAGE_MAP();
}
//************Hello.cpp************
#include <afxwin.h>
#include ".\hello.h"
CMyApp myApp;
CMyApp::CMyApp(void)
{
}
CMyApp::~CMyApp(void)
{
 }
CMainWindow::CMainWindow(void)
{
 Create(NULL , _T("The Hello Application"));
}
CMainWindow::~CMainWindow(void)
{
}
BOOL CMyApp::InitInstance()
{
 m_pMainWnd = new CMainWindow;
 m_pMainWnd->ShowWindow(m_nCmdShow);
 m_pMainWnd->UpdateWindow();
 return TRUE;
}
BEGIN_MESSAGE_MAP(CMainWindow , CFrameWnd)
 ON_WM_PAINT()
END_MESSAGE_MAP()
void CMainWindow::OnPaint()
{
 CPaintDC dc(this);
 CRect rect;
 GetClientRect(&rect);
 dc.DrawText(_T("Hello World") , -1 , &rect , DT_SINGLELINE|DT_CENTER|DT_VCENTER);
}
问题是:对于m_pMainWnd用不用delete呢?