Click here to Skip to main content
15,884,237 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.
// AtlView3.cpp : Implementation of CAtlView3

#include "stdafx.h"
#include "MfcViewLib.h"
#include "AtlView3.h"


// CAtlView3


STDMETHODIMP CAtlView3::get_Name(BSTR *pVal)
{
	// TODO: Add your implementation code here
	return m_pMfcWnd->m_pTangramObject->getAPCName(pVal);
}

STDMETHODIMP CAtlView3::put_Name(BSTR newVal)
{
	// TODO: Add your implementation code here
	return m_pMfcWnd->m_pTangramObject->putAPCName(newVal);
}

/////////////////////////////////////////////////////////////////////////////
// CShareFormView3

IMPLEMENT_DYNCREATE(CShareFormView3, CFormView)

CShareFormView3::CShareFormView3()
	: CFormView(CShareFormView3::IDD)
	, m_strEdit(_T(""))
{
	//{{AFX_DATA_INIT(CShareFormView3)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	bHooked = false;
	m_pComObj = new CComObject<CAtlView3>;
	m_pComObj->m_pMfcWnd = this;
	m_pTangramObj = g_pTangramServer->m_pCurTangramObj2;
	m_pTangramObject = g_pTangramServer->m_pCurTangramObj;
	if(m_pTangramObject)
	{
		m_pTangramObject->m_pDisp = m_pComObj;
		g_pTangramServer->m_pCurTangramObj=NULL;
	}
	else
	{
		m_pTangramObj->m_ObjClsID = CLSID_AtlView3;
		m_pTangramObj->bHooked=true;
		m_pTangramObj->m_pDisp=m_pComObj;

		g_pTangramServer->m_pCurTangramObj2=NULL;
		bHooked= true;
	}
	//m_pTangramObject = g_pTangramServer->m_pCurTangramObj;
	//g_pTangramServer->m_pCurTangramObj->m_pDisp = m_pComObj;
}

CShareFormView3::~CShareFormView3()
{
	if(!g_pTangramServer->m_bHook)
		if(m_pComObj)
		{
			//delete m_pComObj;
			//m_pComObj=NULL;
		}
}

void CShareFormView3::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CShareFormView3)
	// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
	DDX_Text(pDX, IDC_EDIT1, m_strEdit);
}


BEGIN_MESSAGE_MAP(CShareFormView3, CFormView)
	//{{AFX_MSG_MAP(CShareFormView3)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
	ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CShareFormView3 diagnostics

#ifdef _DEBUG
void CShareFormView3::AssertValid() const
{
	CFormView::AssertValid();
}

void CShareFormView3::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CShareFormView3 message handlers
BOOL CShareFormView3::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
	// TODO: Add your specialized code here and/or call the base class
	AfxSetResourceHandle(theApp.m_hInstance);
	return CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
void CShareFormView3::OnInitialUpdate() 
{
	//TODO: This code navigates to a popular spot on the web.
	//Change the code to go where you'd like.
	if(m_pTangramObject&&!m_pTangramObject->bDefineRegist)
	{
		if(!m_pTangramObject->isRegist)
		{
		}
		else
		{
		}
		m_pTangramObject->bDefineRegist=true;
	}
}

void CShareFormView3::OnBnClickedButton1()
{
	// TODO: Add your control notification handler code here
	AfxMessageBox(_T("I'm in Form 3"));
}

STDMETHODIMP CAtlView3::GetText(BSTR str)
{
	//AFX_MANAGE_STATE(AfxGetStaticModuleState());

	// TODO: Add your implementation code here
	m_pMfcWnd->m_strEdit=str;
	m_pMfcWnd->UpdateData(FALSE);
	return S_OK;
}

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