Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

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

0.00/5 (No votes)
2 Jun 2005 1  
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.

Introduction

Abstract

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.

Install Wizard

At first, you must download �TangramLittle.zip�, then decompress this file, we obtained a directory �Program Files�, this directory have two sub-directories, copy all sub-directories of this directory into your computer�s �Program Files� directory, thus, you have installed the Wizard.

Config your VC++ Environment Variable

There is a Static Library Project �MfcDotNetExtLib� in directory �Program Files\ Microsoft Visual Studio .NET 2003\ TangramLittle\ MfcDotNetExtLib�, please set Include Path to this directory and set Lib PathProgram Files\ Microsoft Visual Studio .NET 2003\ TangramLittle\ MfcDotNetExtLib\lib�.

Build a TangramLittle Application

This is very simple, just use the wizard to create a TangramLittle Project.

Wizard for TangramLittle Application

This is an MFC project which has no Main window.

Create a MainFrame Project

You can create a MainFrame Project by wizard:

Wizard for MainFrame Object

Create a Doc/View Project

You can create a Doc/View Project by wizard:

Wizard for Document Template

Use TangramLittle, MainFrame Project and Doc/View Project to Compose an Application

Using the program config file, we can compose an Application. A typical config file is:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <appSettings> 
    </appSettings> 
<runtime> 
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
           <probing privatePath="bin;usercontrol;component;doctemplate"/> 
      </assemblyBinding> 
</runtime> 
<Tangram 
      MainAppType = ".net" 
      MainAssemblyLib = "mainframe1" 
      MainAssemblyCategory= "mainframe1" 
      MainFrameAssembly = "mainframe1.AppObject" 
      ExternalAppAssembly = "" 
      WorkSpaceGUID = "{9905F281-9C5D-440b-89AF-EE61D3FA548A}" 
> 
      <Caption>Welcome To Tangram World!</Caption> 
      <WorkSpace>MSDNDocIntegrationSample.App</WorkSpace> 
      <BackgroundType>mfcview</BackgroundType> 
      <BackgroundFile></BackgroundFile> 
      <RegistryKey>MSDNDocIntegrationSample</RegistryKey> 
      <StdProfileSettings>4</StdProfileSettings> 
      <RunModel></RunModel> 
      <Skin>Merlin ENI\Merlin ENI.uis</Skin> 
</Tangram> 
</configuration>

In a config file, MainAssemblyLib = "mainframe1" assigns a mainframe object assembly, MainAssemblyCategory= "mainframe1" assignd a sub-directory in the directory �Program Files\TangramUniverseDocument� which stores TangramLittle application�s MainFrame data, MainFrameAssembly = "mainframe1.AppObject" assigns mainframe object ID in the assembly which is assigned by MainAssemblyLib = "mainframe1". <BackgroundType>mfcview</BackgroundType> assigns MDI Client Type, TangramLittle Support use HTML, Flash Movie, and other Views (.NET Control) as MDI Client Background Window.

Demo

We supply a Demo (Demo.zip and MSDNDocIntegrationSample.zip) which shows how to use a config file to config a TangramLittle application, each mainframe object corresponds an MFC Document (a .app file, for detail information please observe the directory �Program Files\TangramUniverseDocument�), for each mainframe, there exists a directory (name: �Program Files\TangramUniverseDocument\ Your Company Name\ mainframe\DocumentTemplate�), this directory consists of XML files, each XML file descripts a document template.

Some Snapshots

Config Demo 1

Config Demo 2

Config Demo 3

If you have any question, please contact me.

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