Invoking Scripts

 

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 Invoking Scripts (ATL).

Using Replaceable Parameters (The Registrar's Preprocessor)](../Topic/Using%20Replaceable%20Parameters%20(The%20Registrar's%20Preprocessor).md) discusses replacement maps and mentions the Registrar method AddReplacement. The Registrar has eight other methods specific to scripting, and all are described in the following table.

MethodSyntax/Description
ResourceRegisterHRESULT ResourceRegister( LPCOLESTR  resFileName , UINT  nID , LPCOLESTR  szType );

Registers the script contained in a module's resource. resFileName indicates the UNC path to the module itself. nID and szType contain the resource's ID and type, respectively.
ResourceUnregisterHRESULT ResourceUnregister( LPCOLESTR  resFileName , UINT  nID , LPCOLESTR  szType );

Unregisters the script contained in a module's resource. resFileName indicates the UNC path to the module itself. nID and szType contain the resource's ID and type, respectively.
ResourceRegisterSzHRESULT ResourceRegisterSz( LPCOLESTR  resFileName , LPCOLESTR  szID , LPCOLESTR  szType );

Registers the script contained in a module's resource. resFileName indicates the UNC path to the module itself. szID and szType contain the resource's string identifier and type, respectively.
ResourceUnregisterSzHRESULT ResourceUnregisterSz( LPCOLESTR  resFileName , LPCOLESTR  szID , LPCOLESTR  szType );

Unregisters the script contained in a module's resource. resFileName indicates the UNC path to the module itself. szID and szType contain the resource's string identifier and type, respectively.
FileRegisterHRESULT FileRegister( LPCOLESTR  fileName  );

Registers the script in a file. fileName is a UNC path to a file that contains (or is) a resource script.
FileUnregisterHRESULT FileUnregister( LPCOLESTR  fileName  );

Unregisters the script in a file. fileName is a UNC path to a file that contains (or is) a resource script.
StringRegisterHRESULT StringRegister( LPCOLESTR  data  );

Registers the script in a string. data contains the script itself.
StringUnregisterHRESULT StringUnregister( LPCOLESTR  data  );

Unregisters the script in a string. data contains the script itself.

ResourceRegisterSz and ResourceUnregisterSz, are similar to ResourceRegister and ResourceUnregister, but allow you to specify a string identifier.

The methods FileRegister and FileUnregister are useful if you do not want the script in a resource or if you want the script in its own file. The methods StringRegister and StringUnregister allow the .rgs file to be stored in a dynamically allocated string.

Creating Registrar Scripts

Show: