AskYesNo

InstallShield 2014 » InstallScript Language Reference

Project: This information applies to the following project types:

Basic MSI
InstallScript
InstallScript MSI

The AskYesNo function presents a message box that displays a question the end user can answer by clicking a Yes or No button. The AskYesNo message contains four items:

Question mark icon
Question text
Yes button
No button

Note: The default title is Question. To change the contents of the title bar, call SetDialogTitle before calling AskYesNo.

The AskYesNo message box is created by a direct call to the corresponding Windows API function, which displays a system modal dialog. Once a modal dialog is displayed, it retains focus until it is closed by the end user.

Because this dialog is displayed by Windows, the text in the buttons cannot be changed by the installation. That text—"Yes" and "No" in the English version—is displayed by Windows in the language appropriate to the version of Windows on which the installation is being run; 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

AskYesNo ( szQuestion, nDefault );

Parameters

AskYesNo Parameters

Parameter

Description

szQuestion

Specifies the question to display in the message box. If the message is too large to fit on one line, embed newline escape characters ( \n ) in the message to insert line breaks.

nDefault

Specifies the button that is selected by default. Pass one of the following predefined constants in this parameter:

YES—The Yes button is highlighted when the dialog opens.
NO—The No button is highlighted when the dialog opens.

Return Values

AskYesNo Return Values

Return Value

Description

YES (1)

Indicates that the user clicked the Yes button.

NO (0)

Indicates that the user clicked the No button.

Additional Information

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

See Also