Click here to Skip to main content
15,891,657 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.
// DocumentPropertyDlg.cpp : implementation file
//

#include "stdafx.h"
#include "VisualFrameWork.h"
#include "DocumentPropertyDlg.h"
#include "VisualFrameWorkDoc.h"
#include "DocumentCtrl.h"


// CDocumentPropertyDlg dialog

IMPLEMENT_DYNAMIC(CDocumentPropertyDlg, CDialog)
CDocumentPropertyDlg::CDocumentPropertyDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CDocumentPropertyDlg::IDD, pParent)
	, m_strCaption(_T(""))
	, m_strObjID(_T(""))
{
	m_pDoc = NULL;
}

CDocumentPropertyDlg::~CDocumentPropertyDlg()
{
}

void CDocumentPropertyDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_CAPTION, m_strCaption);
	DDX_Text(pDX, IDC_DOCCOMCTRL, m_strObjID);
}


BEGIN_MESSAGE_MAP(CDocumentPropertyDlg, CDialog)
	ON_BN_CLICKED(IDC_BUTTON_DOCPROPERTY, OnBnClickedButtonDocproperty)
	ON_BN_CLICKED(IDOK, OnBnClickedOk)
END_MESSAGE_MAP()


// CDocumentPropertyDlg message handlers

void CDocumentPropertyDlg::OnBnClickedButtonDocproperty()
{
	// TODO: Add your control notification handler code here
	if(m_pDoc)
		m_pDoc->m_pDocument->DocProperty();
}

void CDocumentPropertyDlg::OnBnClickedOk()
{
	// TODO: Add your control notification handler code here
	UpdateData(true);
	if(m_pDoc)
	{
		//m_pDoc->m_strTitle = m_strCaption;
		m_pDoc->m_pDocument->m_bstrCaption = m_strCaption.AllocSysString();
		if(m_pDoc->m_bMainDoc)
			theApp.m_pMainWnd->SetWindowText(m_strCaption);
		m_pDoc->SetTitle(m_strCaption);
		m_pDoc->strComObjID = m_strObjID;
	}
	OnOK();
}

BOOL CDocumentPropertyDlg::OnInitDialog()
{
	USES_CONVERSION;
	CDialog::OnInitDialog();

	// TODO:  Add extra initialization here
	if(m_pDoc)
	{
		m_strCaption = OLE2T(m_pDoc->m_pDocument->m_bstrCaption);
		m_strObjID = m_pDoc->strComObjID;
		UpdateData(false);
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}

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