GetFolderNameList

InstallShield 2024 » InstallScript Language Reference

The GetFolderNameList function is used to enumerate all program item shortcuts and subfolders in a specified folder. This function can also be used to enumerate program item shortcuts and subfolders in the root folder.

Syntax

GetFolderNameList ( szFolderName, listItemsID, listSubFoldersID );

Parameters

GetFolderNameList Parameters

Parameter

Description

szFolderName

Specifies the name of the folder to be queried. You can specify a fully qualified path for szFolderName, such as:

“C:\\Windows\\Start Menu\\Programs\\Accessories\\Games”

If szFolderName is null, GetFolderNameList 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, GetFolderNameList 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—Searches the Desktop folder.
FOLDER_STARTUP—Searches the Startup menu.
FOLDER_STARTMENU—Searches the Start menu.
FOLDER_PROGRAMS—Searches the Start Menu\Programs folder.

Or you could use a relative path, such as:

FOLDER_PROGRAMS ^ "ACCESSORIES\\GAMES"

listItemsID

Returns a list with the names of the program item shortcuts in szFolderName. Note that if szFolderName includes both personal and common program items, the list returned in this parameter will contain either the common or personal program item shortcuts, but not both. The list identified by listItemsID must already have been initialized by a call to ListCreate.

listSubFoldersID

Returns a list with the names of the subfolders in szFolderName. Note that if szFolderName includes both personal and common folders, the list returned in this parameter will contain either the common or personal folders, but not both. The list identified by listSubFoldersID must already have been initialized by a call to ListCreate.

Return Values

GetFolderNameList Return Values

Return Value

Description

0

GetFolderNameList successfully retrieved all the programs items and subfolder names.

< 0

GetFolderNameList was unable to retrieve the program items and subfolder names.

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

See Also