Click here to Skip to main content
15,884,353 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.
// AtlView2.h : Declaration of the CAtlView2

#pragma once
#include "resource.h"       // main symbols

#include "_IAtlView2Events_CP.h"
#include "MfcViewLib_i.h"


// CAtlView2
class CShareFormView2;
class ATL_NO_VTABLE CAtlView2 : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CAtlView2, &CLSID_AtlView2>,
	public IConnectionPointContainerImpl<CAtlView2>,
	public IProvideClassInfo2Impl<&CLSID_AtlView2, &__uuidof(_IAtlView2Events), &LIBID_MfcViewLibLib>,
	public CProxy_IAtlView2Events<CAtlView2>, 
	public IDispatchImpl<IAtlView2, &IID_IAtlView2, &LIBID_MfcViewLibLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
	CShareFormView2 *m_pMfcWnd;
	CAtlView2()
	{
	}

DECLARE_REGISTRY_RESOURCEID(IDR_ATLVIEW2)


BEGIN_COM_MAP(CAtlView2)
	COM_INTERFACE_ENTRY(IAtlView2)
	COM_INTERFACE_ENTRY(IDispatch)
	COM_INTERFACE_ENTRY(IProvideClassInfo)
	COM_INTERFACE_ENTRY(IProvideClassInfo2)
	COM_INTERFACE_ENTRY(IConnectionPointContainer)
END_COM_MAP()

BEGIN_CONNECTION_POINT_MAP(CAtlView2)
	CONNECTION_POINT_ENTRY(__uuidof(_IAtlView2Events))
END_CONNECTION_POINT_MAP()

	DECLARE_PROTECT_FINAL_CONSTRUCT()

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

public:
	STDMETHOD(get_Name)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(put_Name)(/*[in]*/ BSTR newVal);

	STDMETHOD(TestEvent2)(void);
};

OBJECT_ENTRY_AUTO(__uuidof(AtlView2), CAtlView2)

//CShareFormView2DataObj
/////////////////////////////////////////////////////////////////////////////
class CShareFormView2DataObj : public CObject  
{
	DECLARE_SERIAL(CShareFormView2DataObj)
public:
	CShareFormView2DataObj();
	virtual ~CShareFormView2DataObj();

	virtual void Serialize(CArchive& ar);
};


// CShareFormView2
//

/////////////////////////////////////////////////////////////////////////////
// CShareFormView2 window

class CShareFormView2 : public CFormView
{
// Construction
protected:

	CShareFormView2();
	DECLARE_DYNCREATE(CShareFormView2)

// Form Data
public:
	BOOL bHooked;
	//{{AFX_DATA(CShareFormView2)
	enum { IDD = IDD_CShareFormView2 };
	//}}AFX_DATA

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CShareFormView2)
	public:
	virtual void OnInitialUpdate();
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
public:
	CTangramObject* m_pTangramObject;
	CTangramObj* m_pTangramObj;
	CComObject<CAtlView2> *m_pComObj;
	CShareFormView2DataObj *m_pData;
protected:
	virtual ~CShareFormView2();

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
protected:
	//{{AFX_MSG(CShareFormView2)
		// NOTE - the ClassWizard will add and remove member functions here.
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedButton1();
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

//-1

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