Understanding Text Template Parsing

HomeOverviewsHow Do IDetailsSample

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 Visual C++ Editions.

The function CCustomAppWiz::ProcessTemplate parses a template line by line and passes everything that is not a macro or directive directly to an output stream. If a line contains a macro, which is not an argument to a directive, ProcessTemplate replaces the macro with its associated value, retrieved from the dictionary, and passes the altered line to the output stream. For example, given a project named MyProject and an output stream named ROOT.CPP, the following line in a text template:

#include "$$root$$.h"

becomes

#include "MyProject.h"

in a project file named MYPROJECT.CPP. For more information on macros, see How Macros Get Their Values.

If a line is a directive, ProcessTemplate obeys the rules set down by the directive. For more information on directives, see Standard MFC AppWizard Directives.

ProcessTemplate passes the parsed string to MFCAPWZ.DLL. If the output stream is directed to CONFIRM.INF or NEWPROJ.INF, MFCAPWZ.DLL will use the files during the project generation process. For more information on these files, see CONFIRM.INF and NEWPROJ.INF.

If the output stream represents a source file, MFCAPWZ.DLL does no further processing of the file. Instead, MFCAPWZ.DLL inserts the file into a new project structure following rules set out in NEWPROJ.INF.

What do you want to know more about?