InstallShield 2016 » 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 DefineDialog, EndDialog, and ReleaseDialog
* functions.
*
* This script opens a simple custom dialog that displays
* a bitmap. The dialog can be closed with any of three
* buttons: Back, Next, or Cancel.
*
* The "custom" dialog used in this script is actually the
* InstallShield Sd dialog that is displayed by the built-in
* function SdBitmap. Because this dialog is stored in
* the file _isres.dll, which is already compressed in
* the installation, it can be used in a script as a custom
* dialog.
*
* In order to use this dialog as a custom dialog, the
* script first defines it by calling DefineDialog. It then
* displays the dialog by calling WaitOnDialog. When an event
* ends dialog processing, EndDialog is called to close the
* dialog. Then the dialog is released from memory by
* a call to ReleaseDialog.
*
\*--------------------------------------------------------------*/
// Dialog and control IDs.
#define RES_DIALOG_ID 12027 // ID of dialog itself
#define RES_PBUT_NEXT 1 // ID of Next button
#define RES_PBUT_CANCEL 9 // ID of Cancel button
#define RES_PBUT_BACK 12 // ID of Back button
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_DefineDialog(HWND);
function ExFn_DefineDialog(hMSI)
STRING szDialogName, szDLLName, szDialog;
NUMBER nDialog, nResult, nCmdValue;
BOOL bDone;
HWND hInstance, hwndParent, hwndDlg;
begin
// Define the name of a dialog to pass as first
// parameter to DefineDialog.
szDialogName = "ExampleDialog";
// DefineDialog's second parameter will be 0 because the
// .dll file is in _isres.dll.
hInstance = 0;
// DefineDialog's third parameter will be null; installation will
// search for the dialog in _isuser.dll and _isres.dll.
szDLLName = "";
// DefineDialog's fifth parameter will be null because the
// dialog is identified by its ID in the fourth parameter.
szDialog = "";
// This value is reserved and must be 0.
hwndParent = 0;
// Define the dialog. The installation's main window will own the
// dialog (indicated by HWND_INSTALL in parameter 7).
nResult = DefineDialog (szDialogName, hInstance, szDLLName,
RES_DIALOG_ID, szDialog, hwndParent,
HWND_INSTALL, DLG_MSG_STANDARD|DLG_CENTERED);
// Check for an error.
if (nResult < 0) then
MessageBox ("An error occurred while defining the dialog.", SEVERE);
bDone = TRUE;
abort;
endif;
// Initialize the indicator used to control the while loop.
bDone = FALSE;
// Loop until done.
repeat
// Display the dialog and return the next dialog event.
nCmdValue = WaitOnDialog(szDialogName);
// Respond to the event.
switch (nCmdValue)
case DLG_CLOSE:
// The user clicked the window's Close button.
Do (EXIT);
case DLG_ERR:
MessageBox ("Unable to display dialog. Setup canceled.", SEVERE);
abort;
case DLG_INIT:
// Initialize the back, next, and cancel button enable/disable states
// for this dialog and replace %P, %VS, %VI with
// IFX_PRODUCT_DISPLAY_NAME, IFX_PRODUCT_DISPLAY_VERSION, and
// IFX_INSTALLED_DISPLAY_VERSION, respectively, on control IDs 700-724 and 202.
hwndDlg = CmdGetHwndDlg(szDialogName);
SdGeneralInit(szDialogName, hwndDlg, 0, "");
case RES_PBUT_CANCEL:
// The user clicked the Cancel button.
Do (EXIT);
case RES_PBUT_NEXT:
bDone = TRUE;
case RES_PBUT_BACK:
bDone = TRUE;
// check standard handling
if (SdIsStdButton( nCmdValue ) && SdDoStdButton( nCmdValue )) then
bDone = TRUE;
endif;
endswitch;
until bDone;
// Close the dialog.
EndDialog (szDialogName);
// Free the dialog from memory.
ReleaseDialog (szDialogName);
end;
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |