Click here to Skip to main content
15,878,748 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.2K   668   24  
Introduce a programming technology to design a very complex, rich document type.
// DocumentPropertyPage.h : Declaration of the CDocumentPropertyPage


#pragma once

#include "resource.h"       // main symbols
#include "VisualFrameWork.h"

// CDocumentPropertyPage

class ATL_NO_VTABLE CDocumentPropertyPage :
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CDocumentPropertyPage, &CLSID_DocumentPropertyPage>,
	public IPropertyPageImpl<CDocumentPropertyPage>,
	public CDialogImpl<CDocumentPropertyPage>
{
public:
	CDocumentPropertyPage() 
	{
		m_dwTitleID = IDS_TITLEDocumentPropertyPage;
		m_dwHelpFileID = IDS_HELPFILEDocumentPropertyPage;
		m_dwDocStringID = IDS_DOCSTRINGDocumentPropertyPage;
	}

	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		return S_OK;
	}
	
	void FinalRelease() 
	{
	}

	enum {IDD = IDD_DOCUMENTPROPERTYPAGE};

DECLARE_REGISTRY_RESOURCEID(IDR_DOCUMENTPROPERTYPAGE)

DECLARE_NOT_AGGREGATABLE(CDocumentPropertyPage)

BEGIN_COM_MAP(CDocumentPropertyPage) 
	COM_INTERFACE_ENTRY(IPropertyPage)
END_COM_MAP()

BEGIN_MSG_MAP(CDocumentPropertyPage)
	CHAIN_MSG_MAP(IPropertyPageImpl<CDocumentPropertyPage>)
END_MSG_MAP()

// Handler prototypes:
//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

	STDMETHOD(Apply)(void)
	{
		ATLTRACE(_T("CDocumentPropertyPage::Apply\n"));
		for (UINT i = 0; i < m_nObjects; i++)
		{
			// Do something interesting here
			// ICircCtl* pCirc;
			// m_ppUnk[i]->QueryInterface(IID_ICircCtl, (void**)&pCirc);
			// pCirc->put_Caption(CComBSTR("something special"));
			// pCirc->Release();
		}
		m_bDirty = FALSE;
		return S_OK;
	}
};


OBJECT_ENTRY_AUTO(__uuidof(DocumentPropertyPage), CDocumentPropertyPage)

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