Click here to Skip to main content
15,885,960 members
Articles / Desktop Programming / MFC

Develop MFC Doc/View Application Which Supports Any Number Document Template

Rate me:
Please Sign up or sign in to vote.
1.57/5 (3 votes)
2 Jun 20052 min read 36.5K   1.7K   26  
This article provides an introduction to TangramLittle, a C++ Framework for MFC and the .NET Framework. Knowledge in MFC and the .NET Framework is assumed.
// [!output PROJECT_NAME].h : main header file for the [!output PROJECT_NAME] DLL
//

#pragma once

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif

#include "resource.h"		// main symbols
#include "AppObject.h"
#using <mscorlib.dll>
using namespace System;
using namespace System::Configuration;
using namespace System::Reflection;
using namespace System::Xml;
using namespace [!output PROJECT_NAME];

// [!output APP_CLASS]
// See [!output PROJECT_NAME].cpp for the implementation of this class
//
/**************************************************************************************************
���������ڶ��󹤳̣�
ÿ��TangramLittleӦ�ó���������ھ��������ڳ���֮�⣬�����Ҫһ��������ṩ����ʱ�����ڡ������ڶ���
���ڵĶ�̬���ӿ��װ�˳���MFC���̵���������ص����������������൱��һ�������ĵ���SDI����ͨ��Ӧ��
����������ļ������ڶ�����TangramLittle����������һ�������ڶ��󹤳��ṩMFC������Ҫ��CMainFrame�࣬
����ͬʱ�ṩ��һ������.NET��AppObject�������������CMainFrame�����γ�һ����ż�ԣ�AppObject�����ṩ
��Ҫ������CMainFrame������.NET�������û��򿪷��߻������ṩһ����չAppObject�����������ķ�ʽ��TangramLittle
Ӧ��ϵͳ�γ�����ǿ��Ķ��ο������ƣ���ԭ���ϣ�����γɵĶ��ο�������ʮ��������Microsoft VBA��VSA��
һ��˵���������ڶ��󹤳��γɵ�Ⱥ�����ΪӦ��ϵͳ�ڲ�ͬ�����󳡺��ṩ��ͬ������ʱ��̬������һ���˻�һ
����˾���Ը��ݳ���ѡ��ס����칫��һ�������ǽ���������Բ�ͬ��������ģ�ͣ�������ƥ��һ���ĵ�ģ�壬��
�������ģʽ������Ӧ�ó�����֯�����γɽ��������������ı�����
**************************************************************************************************/
class [!output APP_CLASS] : public [!output APP_BASE_CLASS]
{
public:
	[!output APP_CLASS]();
	CString m_strCreateInfo;
	/*About AppObject 
	In general, a document based application usually supply an object (COM based or .NET based) 
	in order to make application system customize easily. Suppose there exist such a object in your 
	own application, then it can be automation by other system just like Microsoft Office System do.
	MFC Application with .NET Support provide you the ability.We provide you the implementation 
	method of application object based on .NET framework.
	And how?
	With MFC Application with .NET Support ,your can create such kind of object by other 
	lanageuage such as VB.Net, VC# etc, and use it in your MFC based application, 
	or you can derive it from an existed object. The AppObject's properties, methods and events will 
	be designed for the	application's reconstruct.Application system load AppObject by its 
	object ID from a file(say an XML file) or from Registry.
	In general, your can use an appobject to Initial an application's function. 
	*/
	gcroot<[!output PROJECT_NAME]::AppObject*>	m_pAppObj;
	CMapStringToOb				m_PrjItemDictionary;

	CMapStringToOb				m_DocTemplateDictionary;

// Implementation
	BOOL CreateFileFromResource(LPCTSTR lpszResourceName, LPCTSTR lpszType, LPCTSTR lpszTargetName);
	Object* GetManagedObj(IDispatch* m_pComObjDisp);
	CString StringToCStr(String* str);
// Overrides
public:
	virtual BOOL InitInstance();

	DECLARE_MESSAGE_MAP()
};

extern [!output APP_CLASS] theApp;

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



Comments and Discussions