Monday, January 3, 2011

How we connect the Document class, View class & the Frame Window class

Document templates serve as the connection between documents, frame windows and views. Document templates class is define in the Application Class

CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CSetPaneSizeDoc),
RUNTIME_CLASS(CMainFrame),       // main SDI frame window
RUNTIME_CLASS(CSetPaneSizeView));
AddDocTemplate(pDocTemplate);


Code explaination:
CSetPaneSizeDoc derived from CDocument.
CSetPaneSizeView derived from CView.
CMainFrame derived from CFrameWnd.


Post Script:
For this dedicated tutorial, the full derivation is, which we interest (just for fun info)
CSetPaneSizeDoc: CDocument: CCmdTarget: CObject
CSetPaneSizeView: CFormView: CScrollView: CView:CWnd: CCmdTarget: CObject
CMainFrame :CFrameWndEx:CFrameWnd: :CWnd: CCmdTarget: CObject

No comments:

Post a Comment