Share via


Understanding Text Templates

OverviewsHow Do IDetails

Feature Only in Professional and Enterprise Editions   Creating a Custom AppWizard is supported only in Visual C++ Professional and Enterprise Editions. For more information, see .

A text template is a type of custom resource template. AppWizard uses the content of text templates to create the source files of a new project. Text templates typically contain lines of source code, such as C++ code or resource-script directives. Text templates also contain macros and directives that AppWizard uses to determine the final content of template-generated source files.

AppWizard puts templates into the TEMPLATE directory of a generated project. Once templates are part of a project, you can either use them without modification or edit them to add custom functionality to your custom AppWizard. You can also add your own text templates to a project.

The following code-template fragment shows C++ code with embedded macros and directives. The values of macros such as $$ROOT$$ and $$APP_CLASS$$ control the names of files and classes. The existence of macros such as VERBOSE controls whether flow-of-control directives, such as $$IF, evaluate to true.

For more information on macros, see How Macros Get Their Values. For more information on directives, see Standard AppWizard Directives.

// $$root$$.h : main header file for the $$ROOT$$ application

#include "resource.h"      // main symbols

////////////////////////////////////////////////////////////////////////
// $$APP_CLASS$$:
// See $$root$$.cpp for the implementation of this class

class $$APP_CLASS$$ : public $$APP_BASE_CLASS$$
{
public:
   $$APP_CLASS$$();

// Overrides
   // ClassWizard generated virtual function
   // overrides
   //{{AFX_VIRTUAL($$APP_CLASS$$)
   public:
   virtual BOOL InitInstance();
   //}}AFX_VIRTUAL

// Implementation

   //{{AFX_MSG($$APP_CLASS$$)
$$IF(VERBOSE)
   // NOTE - the ClassWizard will add and
   //      remove member functions here.
   //    DO NOT EDIT what you see in these
   //      blocks of generated code!
$$ENDIF
   //}}AFX_MSG
   DECLARE_MESSAGE_MAP()
};

What do you want to know more about?