SelectDirEx

InstallShield 2016 » InstallScript Language Reference

Project • This information applies to the following project types:

InstallScript
InstallScript MSI

The SelectDirEx function displays a dialog that enables the end user to select a folder into which the application will be installed. An edit box can also be displayed to enable the end user to specify a new folder.

This function calls the Windows API function SHBrowseForFolder to display the dialog. For more information on SHBrowseForFolder, see the Windows API documentation.

Note • Windows displays this dialog; therefore, the installation cannot change the text of the buttons on the dialog. Windows displays the button text—"Yes" and "No" on English-based systems—in the language of the operating system; no manual localization of this text is required. If you need to display a more flexible dialog, call a Windows API function directly or use a custom dialog.

Syntax

SelectDirEx ( szTitle, szMsg, szEditBoxStatusText, szTreeControlStatusText, nFlags, svDir );

Parameters

SelectDirEx Parameters

Parameter

Description

szTitle

Specifies the title of this dialog. To display the default title Choose Folder, pass a null string ("") in this parameter.

szMsg

Specifies the message you want to display in this dialog. To display the default instructions for this dialog (Please choose the installation folder), pass a null string ("") in this parameter.

szEditBoxStatusText

Specifies the static text that accompanies the edit box when nFlags specifies BIF_EDITBOX. If nFlags does not specify BIF_EDITBOX, this parameter is ignored.

szTreeControlStatusText

Specifies the static text to accompany the dialog's tree control when nFlags specifies BIF_STATUSTEXT. If nFlags does not specify BIF_STATUSTEXT, this parameter is ignored.

nFlags

Specifies the appearance and functionality of the dialog that is displayed by the function by specifying the same flags that are used for the Windows structure BROWSEINFO. Note that if you pass BIF_BROWSEFORCOMPUTER or BIF_BROWSEFORPRINTER, no edit box is displayed. Pass any of the following constants:

BIF_BROWSEFORCOMPUTER—Enables the end user to select a computer on the network. The Network Neighborhood is preselected in the tree control and the OK button is enabled only if a valid computer name is selected in the tree control. No edit box is displayed, even if BIF_EDITBOX is specified.
BIF_BROWSEFORPRINTER—Enables the end user to select a printer. The My Computer folder is preselected in the tree control. Only computers that include at least one printer are displayed under the Network Neighborhood folder. The OK button is enabled only if a valid printer is selected in the tree control. No edit box is displayed, even if BIF_EDITBOX is specified.
BIF_DONTGOBELOWDOMAIN—Network folders below the domain level are not displayed in the tree control.
BIF_RETURNFSANCESTORS—Shows folders above svDir.
BIF_RETURNONLYFSDIRS—Browses file system folders.

The following constants specify other aspects of the dialog:

BIF_STATUSTEXT—Displays status text in the dialog.
BIF_EDITBOX—Adds an edit field to the Browse dialog. The end user can type a folder name in the edit box. The text specified in the SzEditBoxStaticText parameter appears above the edit box, unless BIF_BROWSEFORCOMPUTER or BIF_BROWSEFORPRINTER is specified. When the end user clicks OK, SelectDirEx checks whether a valid folder name is entered. If not, an error message appears and the dialog is not closed.

svDir

Specifies the name of a folder that will appear as the default selection. Returns the fully qualified name of the folder selected by the end user. If a valid folder name that exists on the target system is specified in this parameter, the specified folder is preselected in the tree control.

Return Values

SelectDirEx Return Values

Return Value

Description

IDOK (1)

Indicates that the end user clicked the OK button.

IDCANCEL (2)

Indicates that the end user clicked the Cancel button.

< 0

Indicates that the function was unable to display the dialog.

Additional Information

The dialog that is displayed by this function cannot be displayed with a skin; it appears the same regardless of whether you have specified a skin.

See Also