#define

InstallShield 2016 » InstallScript Language Reference

Use #define to define a number or string constant. When you define a constant and assign it a value, InstallShield replaces the constant with that value wherever it appears. For example, the following #define statement sets the value of MAX_SIZE to 145:

    #define  MAX_SIZE       145

The following example declares a string constant with the #define directive:

    #define  STR_MESSAGE    "This is a message."

Once you have defined STR_MESSAGE, you can use it anywhere in the script. A string message you want displayed in SprintfBox or MessageBox cannot be longer than 255 characters. If you want to display more than 255 characters, split your string into two or more parts before displaying it. The 255-character limit includes spaces, escape sequences, and other special characters.

Note • Another way to define constants is in the Preprocessor Defines field on the Compile tab of the Setup Settings dialog box. If you add or change a preprocessor define in the Setup Settings dialog box, you must recompile your setup before the changes will take effect.

Restrictions

There are a few restrictions regarding the #define directive:

InstallShield supports the use of #define to define only macros that involve the simple lexical substitution of a number or a string. You cannot define macros with expressions using multiple terms or operators.
Constants you declare with a #define statement cannot begin with numbers.
Many InstallShield functions use predefined constants. If you try to define one of the predefined constants, the InstallShield Script Compiler generates an error message.
InstallShield assigns a value of zero (0) to an undefined constant.

See Also