View Full Version : How to display custom dialog bozes in InstallScript MSI Projects

02-07-2005, 06:54 AM

One has to use ExDefineDialog and WaitOnDialog to display a custom dialog boxes. These functions use soemthign called DialogId to display the existing dialogues in the InstallShield software. How to find out the dialog IDs for the custom dialogs. Let me know if there is another way.


02-15-2005, 12:41 PM
In the third argument to EzDefineDialog, you can pass the name of the dialog appearing in the Dialogs view as a string: if the dialog is called MyCustomDialog in the Dialogs view, use "MyCustomDialog" in EzDefineDialog...

02-16-2005, 11:21 AM
If you go into the direct editor and then to the dialog section you will find your custom dialog name. Scroll all the way to the rightmost column and you will see the dialog ID's that have been assigned. Find one that is unused and enter it in the column.

02-17-2005, 01:15 PM
Here is the process I take for handling Custom Dialog boxes
1. Switch to Dialog under User Interface
2. Create your custom dialog box with all its controls the way you need it.
3. Swtich to direct editor and select the Dialog table.
4. When you created your dialog you could specify the name you want for the dialog. That name should appear in this table.
5. Find that name and then scroll all the way to the right. The very last column contains the ID.
6. It seems that the default for this ID is 0 (unless I am doing something wrong). Change it to a number that does not conflict with existing dialogs. I usually use numbers in the 13000 range. What value you specify here you have to now define in your script.

Here is how I handle defining my dialogs.
1. Create a CustomDialogs.h file (the name does not matter).
2. In this .h file create prototypes and defines for each dialog and their controls.

prototype License();
prototype AbbrevLicense();
prototype NUMBER FrameWorkRegDlg();
prototype NUMBER PhoneRegDlg();
//define dialog IDs
#define RES_DIALOG_ID 13051
#define LICENSE_DIALOG_ID 13035

//define controls for dialogs
//Control IDs
#define RADIO1 1000
#define RADIO2 1005
#define RADIO3 1010

#define CHECKBOX1 1100
#define CHECKBOX2 1105
#define CHECKBOX3 1110

#define TEXT1 3000
#define TEXT2 3005
#define TEXT3 3010

#define COMBO1 7000
#define COMBO2 7005

3. Create a CustomDialogs.rul file (name does not matter) and define your functions.

// Function: DriverInstall
// Purpose: Custom Dialog requiring user to choose from 2 radio buttons. Large
// text description boxes above and below radio buttons.
function DriverInstall(sMsg, sRadioOne, sRadioTwo)
STRING szDialogName;
HWND hDlg;
BOOL bBasicOnly;
NUMBER nReturn;

// Specify a name to identify the custom dialog in this setup.
szDialogName = "CustomDialog";

// Define the dialog. Pass a null string in the second parameter
// to get the dialog from _isuser.dll or _isres.dll. Pass a null
// string in the third parameter because the dialog is identified
// by its ID in the fourth parameter.
nResult = EzDefineDialog(szDialogName, "", "", TEXT2_RADIO2);

if (nResult < 0) then
// Report an error; then terminate.
MessageBox ("Error in defining dialog", SEVERE);

// Initialize the indicator used to control the while loop.
bDone = FALSE;

// Loop until done.

// Display the dialog and return the next dialog event.
nCmdValue = WaitOnDialog(szDialogName);

// Respond to the event.
switch (nCmdValue)

case 2, DLG_CLOSE:
Do(EXIT); // The user clicked the window's close button.

case DLG_ERR:
MessageBox ("Dialog failed.", SEVERE);
bDone = TRUE;

case DLG_INIT: ;
// No initialization is required for this example.
CtrlSetState(szDialogName, RADIO1, BUTTON_CHECKED);
CtrlSetText(szDialogName, TEXT1, sMsg);
CtrlSetText(szDialogName, TEXT2, ""); //Second text box is not used, so set it to empty string.
CtrlSetText(szDialogName, RADIO1, sRadioOne);
CtrlSetText(szDialogName, RADIO2, sRadioTwo);

hDlg = CmdGetHwndDlg(szDialogName);
SetWindowText(hDlg, "Driver Option"); // Set the window title. Defined in Winsub.rul.

if (CtrlGetState(szDialogName, RADIO1) = BUTTON_CHECKED) then
bInstDriver = FALSE;
elseif (CtrlGetState(szDialogName, RADIO2) = BUTTON_CHECKED) then
bInstDriver = TRUE;

bDone = TRUE;

case SD_PBUT_EXITSETUP: //Cancel button

EndDialog(szDialogName); // Close the dialog box.
ReleaseDialog(szDialogName); // Free the dialog box from memory.
return BACK;

case SD_PBUT_CANCEL: //Esc key


until bDone;

// Close the dialog box.
// Free the dialog box from memory.