基於對話框(3個類):
CAboutDlg
程序名App
程序名Dlg
單文檔(5個類):
CAboutDlg
CMainFrame
程序名App
程序名Doc
程序名View
多文檔(6個類):
CAboutDlg
CMainFrame
程序名App
程序名Doc
程序名View
CChildFrame
多文檔
CAboutDlg(“關於”對話框)
CAboutDlg()
DoDataExchange(CDataExchange* pDX)
CChildFrame(子框架類)
AssertValid()
CChildFrame()
~CChildFrame()
Dump(CDumpContext& dc)
PreCreateWindow(CREATESTRUCT& cs)
CMainFrame(主框架類)
AssertValid()
CMainFrame()
~CMainFrame()
Dump(CDumpContext& dc)
OnCreate(LPCREATESTRUCT lpCreateStruct)
PreCreateWindow(CREATESTRUCT& cs)
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
CMyApp(應用程序類)
CMyApp()
InitInstance()
OnAppAbout()
CMyDoc(文檔類)
AssertValid()
CMyDoc()
~CMyDoc()
Dump(CDumpContext& dc)
OnNewDocument()
Serialize(CArchive& ar)
CMyView(視圖類)
AssertValid()
CMyView()
~CMyView()
Dump(CDumpContext& dc)
GetDocument()
OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
OnDraw(CDC* pDC)
OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
OnPreparePrinting(CPrintInfo* pInfo)
PreCreateWindow(CREATESTRUCT& cs)
Golbals(全局)
theApp
-------------------------------------------------------------------------------
單文檔
CAboutDlg(“關於”對話框)
CAboutDlg()
DoDataExchange(CDataExchange* pDX)
CMainFrame(主框架類)
AssertValid()
CMainFrame()
~CMainFrame()
Dump(CDumpContext& dc)
OnCreate(LPCREATESTRUCT lpCreateStruct)
PreCreateWindow(CREATESTRUCT& cs)
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
CMyApp(應用程序類)
CMyApp()
InitInstance()
OnAppAbout()
CMyDoc(文檔類)
AssertValid()
CMyDoc()
~CMyDoc()
Dump(CDumpContext& dc)
OnNewDocument()
Serialize(CArchive& ar)
CMyView(視圖類)
AssertValid()
CMyView()
~CMyView()
Dump(CDumpContext& dc)
GetDocument()
OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
OnDraw(CDC* pDC)
OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
OnPreparePrinting(CPrintInfo* pInfo)
PreCreateWindow(CREATESTRUCT& cs)
Golbals(全局)
theApp
-------------------------------------------------------------------------------
對話框
CAboutDlg(“關於”對話框)
CAboutDlg()
DoDataExchange(CDataExchange* pDX)
CMyApp(應用程序類)
CMyApp()
InitInstance()
CMyDlg(對話框類)
CMyDlg(CWnd* pParent /*=NULL*/)
DoDataExchange(CDataExchange* pDX)
OnInitDialog()
OnPaint()
OnQueryDragIcon()
OnSysCommand(UINT nID, LPARAM lParam)
HICON m_hIcon;
Golbals(全局)
theApp
CXXXApp是應用程序類,負責程序的啟動和結束
CXXXDlg是主對話框類,程序的主界面。
單文檔就是一個窗口只能處理一個文檔,多文檔就是同時可以處理多個,共享工具欄,菜單欄什么的,對話框就是一個提示用戶進行選擇或者確認的窗體。對話框模板適合於做交互界面,單文檔模板適合於做文件處理,多文檔模板適合於做多文件處理。不過,還是沒法明確這個問題。
對話框模板適合於做交互界面
單文檔模板適合於做文件處理
多文檔模板適合於做多文件處理
單文檔程序打開多個文件會產生多個進程;
多文檔程序打開多個文件只需一個進程。
單文檔只能進行一份文檔或圖片的操作,就是你不能同時在一個程序打開兩個文件
多文檔可以用多個窗口顯示不同的信息,進行不同的任務,有多個視圖環境,可以同時操作多個文件