Click here to Skip to main content
15,891,529 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.
// VisualFrameWork.idl : VisualFrameWork 
//

import "oaidl.idl";
import "ocidl.idl";

#include "olectl.h"

[
	uuid(E27845DE-56C2-4198-9836-73A5EF504B4E),
	version(1.0),
	helpstring("VisualFrameWork 1.0 ���Ϳ�")
]
library VisualFrameWorkLib
{
	importlib("stdole32.tlb");
	importlib("stdole2.tlb");
	[
		object,
		uuid(6D47F54A-3D8C-497E-9556-DD615F1592C7),
		dual,
		helpstring("IApplication Interface"),
		pointer_default(unique)
	]
	interface IApplication : IDispatch
	{
		[id(1), helpstring("method OpenDoc")] HRESULT OpenDoc([in] BSTR bstrDocName);
	};
	[
		object,
		uuid(F2F1AD64-6520-4D80-A583-3B584DE2FD8C),
		dual,
		helpstring("IDocument Interface"),
		pointer_default(unique)
	]
	interface IDocument : IDispatch
	{
		[propput, id(DISPID_TEXT)]
		HRESULT Text([in]BSTR strText);
		[propget, id(DISPID_TEXT)]
		HRESULT Text([out, retval]BSTR* pstrText);
		[propput, id(DISPID_CAPTION), hidden]
		HRESULT Caption([in]BSTR strCaption);
		[propget, id(DISPID_CAPTION), hidden]
		HRESULT Caption([out,retval]BSTR* pstrCaption);
		[propputref, id(DISPID_PICTURE)]
		HRESULT Picture([in]IPictureDisp* pPicture);
		[propput, id(DISPID_PICTURE)]
		HRESULT Picture([in]IPictureDisp* pPicture);
		[propget, id(DISPID_PICTURE)]
		HRESULT Picture([out, retval]IPictureDisp** ppPicture);
		[propget, id(1), helpstring("property ObjectX")] HRESULT ObjectX([in]BSTR ObjName, [out, retval] IDispatch** pVal);
		[propget, id(2), helpstring("property DocTitle")] HRESULT DocTitle([out, retval] BSTR *pVal);
		[propput, id(2), helpstring("property DocTitle")] HRESULT DocTitle([in] BSTR newVal);
		[propget, id(3), helpstring("property MfcObjectX")] HRESULT MfcObjectX(BSTR ObjName, [out, retval] long *pVal);
		[id(4), helpstring("method CreateSplitter"), hidden] HRESULT CreateSplitter([in]BSTR RowCount, [in]BSTR ColCount,[in]BSTR bstrTitle, [in]BSTR bDocking);
		[id(5), helpstring("method DocProperty")] HRESULT DocProperty();
		[id(6), helpstring("method CreateActiveItem"), hidden] HRESULT CreateActiveItem([in]BSTR bstrClsID, [in]BSTR bstrName);
		[id(7), helpstring("method CreateTabWnd"), hidden] HRESULT CreateTabWnd([in]BSTR bstrClsID,[in]BSTR bstrCaption,[in]BSTR bstrObjName);
		[id(8), helpstring("method CreateDockBar")] HRESULT CreateDockBar([in]BSTR bstrCaption);
		[id(9), helpstring("method DeleteSplitter"), hidden] HRESULT DeleteSplitter();
		[id(10), helpstring("method DeleteTabWnd"), hidden] HRESULT DeleteTabWnd();
		[id(11), helpstring("method DeleteTabPage"), hidden] HRESULT DeleteTabPage([in]long nTabIndex);
		[id(12), helpstring("method AddPage"), hidden] HRESULT AddPage([in]long nPageIndex,[in]BSTR bstrTitle, [in]long nImageIndex);
	};
	[
		uuid(5CD5A9DA-5FB1-42F7-A441-48F29F092C01),
		helpstring("_IApplicationEvents Interface")
	]
	dispinterface _IApplicationEvents
	{
		properties:
		methods:
		[id(1), helpstring("method StartUp")] HRESULT StartUp();
	};
	[
		uuid(63699509-59FD-4AFE-8B37-06E123F0D776),
		appobject,
		helpstring("Application Class")
	]
	coclass Application
	{
		[default] interface IApplication;
		[default, source] dispinterface _IApplicationEvents;
	};

	[
		uuid(A6DFAD18-441F-47E0-961C-755282E63B5D),
		helpstring("_IDocumentEvents Interface")
	]
	dispinterface _IDocumentEvents
	{
		properties:
		methods:
		[id(1), helpstring("method OpenDoc")] HRESULT OpenDoc();
	};

	[
		uuid(DD14E225-65A1-44C9-897F-A8BFA2A99810),
		helpstring("Document Class")
	]
	coclass Document
	{
		[default] interface IDocument;
		[default, source] dispinterface _IDocumentEvents;
	};
	[
		object,
		uuid(619E897E-3847-436E-A84F-1625CDACCA3D),
		dual,
		helpstring("IDocuments Interface"),
		pointer_default(unique)
	]
	interface IDocuments : IDispatch
	{
		[propget, id(3), helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
		[propget, id(DISPID_NewEnum), helpstring("property _NewEnum"), restricted] HRESULT _NewEnum([out, retval] IUnknown**pVal);
		[id(DISPID_Value), helpstring("method Item")] HRESULT Item([in] VARIANT Index, [out, retval] IDocument** ppVal);
		[id(6), helpstring("method Open")] HRESULT Open([in] BSTR FileName, [out, retval] IDocument** ppVal);
		[id(7), helpstring("method Add")] HRESULT Add([out, retval]IDocument** ppVal);
		[id(8), helpstring("method Connect"), hidden] HRESULT Connect([in]long TangramServerObj);
	};
	[
		uuid(5973144C-C9EC-4F71-BB3F-2816F410CE52),
		helpstring("Documents Class")
	]
	coclass Documents
	{
		[default] interface IDocuments;
	};

	[
		object,
		uuid(4CC76E18-6BEA-4D0F-B9BB-B1D9AF27800E),
		dual,
		helpstring("ITangramWindow Interface"),
		pointer_default(unique)
	]
	interface ITangramWindow : IDispatch
	{
		[propputref, id(DISPID_PICTURE)]
		HRESULT Picture([in]IPictureDisp* pPicture);
		[propput, id(DISPID_PICTURE)]
		HRESULT Picture([in]IPictureDisp* pPicture);
		[propget, id(DISPID_PICTURE)]
		HRESULT Picture([out, retval]IPictureDisp** ppPicture);
	};

	[
		uuid(8D5284DD-1CA5-4B85-884D-D9AC8A9BE8EA),
		helpstring("TangramWindow Class")
	]
	coclass TangramWindow
	{
		[default] interface ITangramWindow;
	};

	[
		object,
		uuid(E262846E-F39F-4873-AE76-DB66BD85E0DC),
		dual,
		nonextensible,
		helpstring("IAtlForm �ӿ�"),
		pointer_default(unique)
	]
	interface IAtlForm : IDispatch{
			[propget, id(1), helpstring("property Name")] HRESULT Name([out, retval] BSTR *pVal);
			[propput, id(1), helpstring("property Name")] HRESULT Name([in] BSTR newVal);
	};
	[
		uuid(2EC63354-2EBD-4108-9D69-D7F434533CF3),
		helpstring("_IAtlFormEvents Interface")
	]
	dispinterface _IAtlFormEvents
	{
		properties:
		methods:
	};
	[
		uuid(6CBA1654-09FA-4908-B0EC-5C50FCE73F86),
		helpstring("AtlForm Class")
	]
	coclass AtlForm
	{
		[default] interface IAtlForm;
		[default, source] dispinterface _IAtlFormEvents;
	};
	[
		uuid(70F4BE87-3401-46FD-843D-A8359E59E72E),
		helpstring("DocumentPropertyPage Class")
	]
	coclass DocumentPropertyPage
	{
		[default] interface IUnknown;
	};
};

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