分类:
2009-03-27 18:32:42
InstallShield 2009 » InstallScript Language Reference
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:
Note
The default title is Question. To change the contents of the title bar, call 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.
AskYesNo ( szQuestion, nDefault );
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:
|
Return Value |
Description |
---|---|
YES (1) |
Indicates that the user clicked the Yes button. |
NO (0) |
Indicates that the user clicked the No button. |
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
InstallShield Help Library
AskYesNo ExampleInstallShield 2009 » InstallScript Language Reference
Note To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release. /*-----------------------------------------------------------*\ * * InstallShield Example Script * * Demonstrates the AskYesNo function. * * This script asks the user whether or not to display the * ReadMe file. If yes, the script launches the Windows * Notepad to open a ReadMe file. * * Note: Before running this script, set the preprocessor * constants so that they reference the fully qualified * names of the Windows Notepad executable and a valid * text file on the target system. * \*-----------------------------------------------------------*/ #define PROGRAM "C:\\Windows\\Notepad.exe" #define PARAM "C:\\Windows\\Readme.txt" // Include Ifx.h for built-in InstallScript function prototypes. #include "Ifx.h" export prototype ExFn_AskYesNo(HWND); function ExFn_AskYesNo(hMSI) begin // Display the AskYesNo dialog. The default is set to Yes. if (AskYesNo("Installation complete. Would you like to read the Readme " + "file now?", YES) = YES) then LaunchApp(PROGRAM, PARAM); endif; end;
| | |
Popup | ||||