Click here to Skip to main content
15,886,689 members
Articles / Desktop Programming / ATL

Create a Universal Document Template which supports Dynamic Frame Window Layout

Rate me:
Please Sign up or sign in to vote.
3.00/5 (8 votes)
14 Dec 20024 min read 49.3K   668   24  
Introduce a programming technology to design a very complex, rich document type.
// ChildFrm.cpp : implementation of the CChildFrame class
//
#include "stdafx.h"
#include "VisualFrameWork.h"

#include "ChildFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CChildFrame

IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)

BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
	ON_WM_DESTROY()
	ON_WM_MDIACTIVATE()
END_MESSAGE_MAP()


// CChildFrame construction/destruction

CChildFrame::CChildFrame()
{
	// TODO: add member initialization code here
//////////////////$tangramapp$////////////////////////////
	m_TangramFrameObj.Create(this);
//////////////////$tangramapp end$////////////////////////////
}

CChildFrame::~CChildFrame()
{
	//////////////////$tangramapp$////////////////////////////
	m_TangramFrameObj.m_pDoc = NULL;
//////////////////$tangramapp end$////////////////////////////
}


BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
	if( !CMDIChildWnd::PreCreateWindow(cs) )
		return FALSE;

	return TRUE;
}


// CChildFrame diagnostics

#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
	CMDIChildWnd::AssertValid();
}

void CChildFrame::Dump(CDumpContext& dc) const
{
	CMDIChildWnd::Dump(dc);
}

#endif //_DEBUG


// CChildFrame message handlers
// CChildFrame ��Ϣ�������
//////////////////$tangramapp$////////////////////////////
CDocument* CChildFrame::GetActiveDocument() 
{
	if(m_TangramFrameObj.m_bActiveFrame)return NULL;
	
	return CMDIChildWnd::GetActiveDocument();
}

void CChildFrame::OnDestroy() 
{
	m_TangramFrameObj.OnDestroy();
	CMDIChildWnd::OnDestroy();
	
	// TODO: Add your message handler code here
	
}

void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd) 
{
	CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
	
	m_TangramFrameObj.OnActivate(bActivate);
	
}

void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
	m_TangramFrameObj.OnUpdateFrameTitle(bAddToTitle);
}
//////////////////$tangramapp end$////////////////////////////

BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
	// TODO: Add your specialized code here and/or call the base class

	return CMDIChildWnd::OnCreateClient(lpcs, pContext);
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions