ReplaceFolderIcon

InstallShield 2019 » InstallScript Language Reference

The ReplaceShortcut function supersedes the ReplaceFolderIcon function.

The ReplaceFolderIcon function replaces a shortcut in a specified folder. You must specify an existing folder, either one you have created with the CreateProgramFolder function or one that already exists on the user's system.

Syntax

ReplaceFolderIcon ( szProgramFolder, szItemName, szNewItem, szCmdLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag );

Parameters

ReplaceFolderIcon Parameters

Parameter

Description

szProgramFolder

Specify the name of the folder that contains the shortcut to replace.

szItemName

Specify the name of the shortcut to replace.

szNewItem

Specify the name of the shortcut as it should appear after the replacement.

szCmdLine

Specify one of the following:

The fully qualified name of the executable associated with the icon, including any command-line parameters.
The fully qualified path if szItemName is a subfolder.

szWorkingDir

Specify the directory where the application's program files are located. (Not applicable if szItemName is a subfolder.) To make the directory that contains the program file the working directory, pass a null string (“”) in this parameter.

szIconPath

Specify the name of an icon file or a valid Windows executable that contains the new icon.

nIcon

If you specified an executable file for szIconPath, specify the icon index in the executable file. Otherwise, enter the number 0 for nIcon.

szShortCutKey

Specify the string that contains the shortcut key sequence the user can press to start the program. For example, if you wanted the user to be able to open the application by depressing the “Ctrl,” the “Alt,” and then the “1” key, specify “Ctrl + Alt + 1” in this parameter.

nFlag

Specify one or more options. Pass the following predefined constants in this parameter. To specify more than one option, combine constants with the OR (|) operator.

NULL—Indicates no options.
REPLACE—Indicates that the existing icon should be replaced with the new icon.
RUN_MAXIMIZED—Indicates that the program should be maximized when launched.
RUN_MINIMIZED—Indicates that the program should be minimized when launched.

Return Values

ReplaceFolderIcon Return Values

Return Value

Description

0

Indicates that the function successfully replaced the shortcut.

< 0

Indicates that the function was unable to replace the icon.

You can obtain the error message text associated with a large negative return value—for example, -2147024891 (0x80070005)—by calling FormatMessage.

See Also