cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gavin_landon
Level 6

Custom Dialogs (DialogID)

I'm just needing an understand of the DIALOG_ID when creating custom dialogs. Do I need to create custom dialog id's for each custom dialog I have or do these ID's reference a type of dialog it's based on?

I have 3 custome dialogs on the first 2 are fine, but the third fails as soon as I call:
nCmdValue = WaitOnDialog (szDialogName);

nCmdValue returns -1; //_FAILED

---- CODE STARTS ----

#define DESTINATION_DLG_ID 12013
#define DESTINATION_TITLE 50
#define DESTINATION_TITLE_TEXT "Destination Location and Instance Name"
#define DESTINATION_DESCRIPTION 51
#define DESTINATION_DESCRIPTION_TEXT "Select Install and then select whether you are installing a New Installation or upgrading an existing instance."
#define DESTINATION_DESCRIPTION_FOLDER 1303
#define DESTINATION_DESCRIPTION_DERNAME 1302
#define DESTINATION_DESCRIPTION_FULLPATH 1304

//declare methods
prototype NUMBER dlg3_DestinationFolder( STRING );

//methods
function NUMBER dlg3_DestinationFolder( szDialogCaption )
string szDialogName, szFullPath, svTmp;
BOOL bDone;
number nCmdValue, nResult;
string szMsg;
HWND hTimesNewRoman14Bold;
number hwndDlg;
begin
// Name of Dialog
szDialogName = "dlg3_Destination";

hTimesNewRoman14Bold = GetFont("Arial", 14, STYLE_BOLD);
nResult = EzDefineDialog (szDialogName, ISUSER, szDialogName, DESTINATION_DLG_ID);

// Initialize the indicator used to control the loop.
bDone = FALSE;
repeat
nCmdValue = WaitOnDialog (szDialogName);
// Respond to the event.
switch (nCmdValue)
case _DLG_CLOSE:
// The user clicked the window's Close button.
Do (EXIT);

case DLG_INIT:
hwndDlg = CmdGetHwndDlg (szDialogName);
//change font
CtrlSetFont(szDialogName, hTimesNewRoman14Bold, DESTINATION_TITLE);

//set Dialog Caption
SetWindowText (hwndDlg, szDialogCaption);

// Set static text description displayed above check boxes.
CtrlSetText (szDialogName, DESTINATION_TITLE, DESTINATION_TITLE_TEXT);

// Set static text description displayed above check boxes.
CtrlSetText (szDialogName, DESTINATION_DESCRIPTION, DESTINATION_DESCRIPTION_TEXT);
case _BUTTON_NEXT:
bDone = TRUE;

case _BUTTON_CANCEL:
Do (EXIT);

case _BUTTON_BACK:
bDone = TRUE;

case _FAILED:
//Failed to create
MessageBox("Error creating Destination dialog.", SEVERE);
abort;

default:
//NumToStr(svCmdValue, nCmdValue);
SprintfBox(SEVERE, szDialogCaption, "'%d' is not a valid case.", nCmdValue);
abort;

endswitch;
until bDone;

//destroy dialog
EndDialog ( szDialogName );

return nCmdValue;
end;
Labels (1)
0 Kudos
16 Replies
gavin_landon
Level 6

Attached is the screen shot of the Dialog Screen..
0 Kudos
RobertDickau
Flexera Alumni

The EzDefineDialog help topic has more information: for a new custom dialog box, you can set the third argument to EzDefineDialog to the string dialog name in the Dialogs view, and the fourth argument is ignored.

If you're modifying an existing dialog box, you'll apparently need to ensure the numeric IDs match up between your code and the Dialogs view...
0 Kudos
gavin_landon
Level 6

Ok, that confused things even more.. If I can go without an ID, then what would cause the error? This is the same code, just different name and ID for the other dialogs.

#define WELCOME_DLG_ID 12011
szDialogName = "dlg1_Welcome";
#define INSTALL_TYPE_DLG_ID 12012
szDialogName = "dlg2_InstallationType";
#define DESTINATION_DLG_ID 12013
szDialogName = "dlg3_Destination";
0 Kudos
gavin_landon
Level 6

Ok, here is an update..

I've tried:
nResult = EzDefineDialog (szDialogName, ISUSER, "", DESTINATION_DLG_ID);

Didn't work..

I copy/pasted the code from my Welcome, changing on the var names from WELCOME_ TO DESTINATION_ and it failed. I then changed the variable, szDialogName = "dlg3_Destination"; to, szDialogName = "dlg1_Welcome"; and it works.

So it looked like a dialog issue. I then deleted the dialog and created a new one with the same name, "dlg3_Destination", but nothing custom on it. It also failed. I then renamed from "dlg3_Destination" to "dlg2_Welcome" to see if it's possibly a naming issue, no luck..

I've tried with and without ISUSER..

I've modified the look to be more like how IS does it with other dialogs..
// ensure general initialization is complete
if ( !bSdInit ) then
SdInit( );
endif;

if (EzDefineDialog( szDialogName, ISUSER, szDialogName, DESTINATION_DLG_ID ) = DLG_ERR) then
return -1;
endif;

EzDefineDialog is failing and return -1 occurs. I've tried creating cloaning other dialogs with nothing custom and calling them, they also fail. Its like the Welcome is the ONLY one that works..

I'm so confused..
0 Kudos
gavin_landon
Level 6

Ok, I think it's 2010.... I created a new project with the same Welcome window and it fails.. I then realized that every window that works was created by 2009 and converted by 2010.

I'm now dead in the water with any installations, please help.
0 Kudos
gavin_landon
Level 6

I've attached a dummy project with no install type files, just a dialog that I clicked edit and then cloan. Renamed it to dlg_Welcome and wrote code for it. This seems to be how it was done in 2009, but maybe I'm missing something in 2010.
0 Kudos
gavin_landon
Level 6

I've been doing as much as I can, guess this thread is dead..

Just in case someone reads is, I found I only have the error when I clone from an existing. If I create a new one from scratch I dont have this issue.
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

Looking at the attached sample project, the numerical ID for the Welcome dialog needs to be used (the reason being the dialog resource is built with a numerical ID and not a string name). In the case of the Welcome dialog, the dialog ID is 10205. Changing the code in the sample project to not pass a string dialog ID and instead passing 10205 as the numerical ID resolved the error creating the dialog.

For edited standard dialogs or cloned standard dialogs, these will receive a numerical dialog ID which then needs to be used when calling EzDefineDialog. For custom dialogs created new in a project, these receive a dialog ID of 0. In this case, the name of the dialog in the dialog tree is built into the resource DLL instead of a numerical ID. The dialog can be set to use a numerical ID instead of a string ID by providing a dialog ID other than 0.
0 Kudos
gavin_landon
Level 6

Are you saying do this:

EzDefineDialog( szDialogName, ISUSER, "", DESTINATION_DLG_ID)

I went base on the Help.. I was trying different ways.. My original is the numerical ID, but based on me creating a new dialog without cloning and using the same code it works fine. This tells me something weird happening during modifying cloned dialogs.
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

The basic rule for determining what value to pass to EzDefineDialog would be as follows:
- For dialogs in the Dialog Editor that have a dialog ID of 0 (or a blank ID field), pass the string name of the dialog as the third (szDialogID) parameter. The string name is typically the name of the dialog listed in the center panel in the list of available dialogs.
- For dialogs in the Dialog Editor that have a dialog ID not equal to 0 (and not blank), pass the ID value provided in the dialog editor as the fourth parameter (nDialogID) to EzDefineDialog. In this case, pass an empty string ("") to szDialogID to prevent the runtime dialog code from attempting to look up the dialog based on the string ID.
0 Kudos
gavin_landon
Level 6

Thank you for that clarification.

- For dialogs in the Dialog Editor that have a dialog ID of 0 (or a blank ID field)


When ever I create a dialog or clone a dialog from another dialog, how do I know if it has an ID or not? I never see the ID in the dialog properties. I've only seen the ID in the Dialog Preview, which is always the same ID, so I assumed that was just part of the picture, not really the ID for that dialog.
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

You can see the dialog ID for each dialog that has been edited by selecting one of the dialog's languages in the center panel, then click on the dialog's title bar in the editor. In the list of properties for the dialog is "Resource Identifier". In the attached screenshot, the dialog ID (Resource Identifier) is 0, and the dialog name (which should be dlg3_Destination) would need to be passed to EzDefineDialog.
0 Kudos
gavin_landon
Level 6

Thank you for this clarification.. I've been struggling around the understanding of when and when not to do this.
0 Kudos
gavin_landon
Level 6

I now see when creating a clone, the ID that shows up.. That explains so much.

Thanks again..
0 Kudos
talaviss
Level 2

you see those identifiers because youre using installscript msi project and not Basic msi project

how can i do it with basic msi project???????
0 Kudos
RobertDickau
Flexera Alumni

With Basic MSI, you don't need dialog IDs, EzDefineDialog, or any script, for that matter; please see the help topics under Creating Installations > Defining the End-User Interface > Working with Dialogs > Working with Dialogs in Basic MSI Projects for information about processing MSI dialog controls.
0 Kudos