Partager via


RenderAddTemplate

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at RenderAddTemplate.

Renders a template file and optionally adds it to the project.

Syntax

  
      function RenderAddTemplate(   
   strTemplateFile,   
   strProjectFile,   
   ProjToAddTo,   
   bOpen    
);  

Parameters

strTemplateFile
The template file name only, excluding path, relative to TEMPLATES_PATH.

strProjectFile
The name of new file created. This string may include the path, but relative to PROJECT_PATH.

ProjToAddTo
The project object. Provide the project name if the created file must be added to the project; otherwise, disregard or pass false if you are not adding the file to the project.

bOpen
If true, open the file in the default editor after adding it to the project.

Remarks

Call this function to render a template file and optionally adds it to the project.

Example

// Declare the project path and the template path.  
var strProjectPath = wizard.FindSymbol("PROJECT_PATH");  
var strTemplatePath = wizard.FindSymbol("TEMPLATES_PATH");  
// Declare the template header and implementation files.  
var strTemplateHeader = wizard.FindSymbol("TEMPLATE_HEADER");  
var strTemplateImpl = wizard.FindSymbol("TEMPLATE_IMPL");  
// Render the template strTemplateHeader and open it in the editor.  
RenderAddTemplate(strTemplateHeader, strHeaderFile, selProj, true);   
// Render the template strTemplateImpl, but do not open it   
// in the editor.  
RenderAddTemplate(strTemplateImpl, strImplFile, selProj, false);  

See Also

Customizing C++ Wizards with Common JScript Functions
JScript Functions for C++ Wizards
Creating a Custom Wizard
Designing a Wizard