GetShortcutInfo

InstallShield 2016 » InstallScript Language Reference

The GetShortcutInfo function checks for the existence of a specific shortcut or subfolder name. If the InstallScript engine finds the shortcut or subfolder, GetShortcutInfo returns its attributes. The attributes include the product’s command line, working directory, icon path, shortcut key, and minimize flag.

To use GetShortcutInfo, enter information in the parameters szShortcutFolder and szName. The InstallScript engine fills the remaining parameters with the shortcut’s or subfolder’s attributes.

Syntax

GetShortcutInfo (szShortcutFolder, szName, svCmdLine, svWrkDir, svIconPath, nvIconIndex, svShortCutKey, nvMinimizeFlag);

Parameters

GetShortcutInfo Parameters

Parameter

Description

szShortcutFolder

Specify the name of the folder that contains the shortcut or subfolder. You can specify a fully qualified path for szShortcutFolder, such as:

"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Games"

If szShortcutFolder is null, GetShortcutInfo searches the default Programs directory. If you do not specify an absolute path (a path that includes a drive specification, for example, "C:\\Program Files\\AppName") for szShortcutFolder, GetShortcutInfo searches for a subfolder under the default Programs directory; the location depends on the value of the InstallScript variable ALLUSERS, as well as the version of Windows on the target system.

You can also use an InstallScript system variable:

FOLDER_DESKTOP—Queries items in the Desktop folder.
FOLDER_STARTUP—Queries items in the Startup menu.
FOLDER_STARTMENU—Queries items in the Start menu.
FOLDER_PROGRAMS—Queries items in the Start\Programs menu.

Or you could use a relative path, such as:

FOLDER_PROGRAMS ^ "ACCESSORIES\\GAMES"

szName

Specify the name of the shortcut or subfolder for which you are looking.

svCmdLine

The function returns either the command line of the item's executable file or the complete path to the subfolder.

svWrkDir

The function returns the full path of the working directory of the program item. (Not applicable if szName is a subfolder.)

svIconPath

The function returns the full path and file name of the .ico file or .exe file. (Not applicable if szName is a subfolder.)

nvIconIndex

The function returns the index of the icon that is used for the shortcut. (Not applicable if szName is a subfolder.)

svShortCutKey

The function returns the item's shortcut key. (Not applicable if szName is a subfolder.)

nvMinimizeFlag

The function returns one of the following constants, indicating whether an application window is minimized when first displayed:

NULL—Indicates that the application's window is not minimized upon startup.
RUN_MINIMIZED—Indicates that the application's window is minimized upon startup.

(Not applicable if szName is a subfolder.)

Return Values

GetShortcutInfo Return Values

Return Value

Description

IS_ITEM (0)

Indicates szName is a shortcut in szShortcutFolder.

IS_FOLDER (1)

Indicates szName is a subfolder in szShortcutFolder.

< 0

Indicates that the function was unable to find the shortcut or subfolder name.

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

Additional Information

The location of the Start menu is different under different languages. The InstallScript engine automatically selects the correct path.

See Also