QueryProgItem

InstallShield 2019 » InstallScript Language Reference

The GetShortcutInfo function supersedes the QueryProgItem function.

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

To use QueryProgItem, enter information in the parameters szFolderName and szItemName. The InstallScript engine fills the remaining parameters with the program item’s attributes.

Syntax

QueryProgItem ( szFolderName, szItemName, svCmdLine, svWrkDir, svIconPath, nvIconIndex, svShortCutKey, nvMinimizeFlag );

Parameters

QueryProgItem Parameters

Parameter

Description

szFolderName

Specifies the name of the folder that contains the item or subfolder. You can specify a fully qualified path for szFolderName, such as:

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

If szFolderName is null, QueryProgItem 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 szFolderName, QueryProgItem 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"

szItemName

Specifies the name of the program item or subfolder to find.

svCmdLine

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

svWrkDir

Returns the full path of the working directory of the program item. (Not applicable if szItemName is a subfolder.)

svIconPath

Returns the fully qualified file name of the .ico file or .exe file. (Not applicable if szItemName is a subfolder.)

nvIconIndex

Returns the index of the icon used for the program item. (Not applicable if szItemName is a subfolder.)

svShortCutKey

Returns the item's shortcut key. (Not applicable if szItemName is a subfolder.)

nvMinimizeFlag

(Not applicable if szItemName is a subfolder.) 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.

Return Values

QueryProgItem Return Values

Return Value

Description

IS_ITEM (0)

Indicates szItemName is a program item or shortcut in szFolderName.

IS_FOLDER (1)

Indicates szItemName is a subfolder in szFolderName.

< 0

Indicates that the function was unable to find the program item 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