RenderAddTemplate

呈现模板文件,还可以将其添加到项目中。

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

参数

  • strTemplateFile
    只是模板文件名(不包括路径),相对于 TEMPLATES_PATH。

  • strProjectFile
    所创建的新文件的名称。 该字符串可以包含路径,但相对于 PROJECT_PATH。

  • ProjToAddTo
    项目对象。 如果所创建的文件必须添加到项目,则提供项目名称;否则,如果不希望将文件添加到项目,则忽略它或传递 false

  • bOpen
    如果为 true,则将文件添加到项目后,在默认编辑器中打开该文件。

备注

调用该函数以呈现模板文件并可选择是否将其添加到项目。

示例

// 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);

请参见

任务

创建自定义向导

概念

用公共 JScript 函数自定义 C++ 向导

设计向导

其他资源

用于 C++ 向导的 JScript 函数