DefineDialog

InstallShield 2014 » InstallScript Language Reference

The DefineDialog function defines a custom dialog. Call this function instead of EzDefineDialog when you need to specify a dialog attribute that cannot be specified with EzDefineDialog.

Note: DefineDialog does not display the custom dialog. To display a custom dialog, you must call WaitOnDialog.

Syntax

DefineDialog ( szDialogName, hInstance, szDLLName, nDialogID, szDialogID, nReserved, hwndOwner, lMsgLevel );

Parameters

DefineDialog Parameters

Parameter

Description

szDialogName

Specifies the name of the custom dialog that you want to define. This name identifies that dialog and is used in all subsequent calls to custom dialog functions. The dialog’s name is case-sensitive—you must use it exactly as you specify in this parameter.

hInstance

Specifies the instance handle of the .dll file in which the dialog resides. If you specify the fully qualified name of the .dll file in szDLLName, you can specify 0 in this parameter. To obtain the instance handle of a .dll file, call the Microsoft Windows API LoadLibrary.

szDLLName

Specifies the name of the .dll file that contains the dialog resource. If this name is not qualified, that is, if you do not specify the drive and path with the file name, the InstallScript engine searches for the .dll file in the Windows folder. If it is not found there, the InstallScript engine searches the folders specified in the search path. When the dialog is located in _isuser.dll, you can specify a null string ("") in this parameter; the InstallScript engine automatically checks _isuser.dll if this parameter is specified as a null string ("").

Note: When you use a .dll file other than _isres.dll or _isuser.dll, you must call UseDLL to load the .dll file before calling DefineDialog. To unload the .dll file from memory, call UnUseDLL after calling ReleaseDialog.

nDialogID

Specifies the dialog’s resource ID if you use a number rather than a string to identify the resource. This parameter is used only when szDialogID is a null string (""). It is recommended that you use nDialogID rather than szDialogID to identify the dialog resource.

szDialogID

Specifies the dialog’s resource ID if you use a string rather than a number to identify the resource. If this parameter is a null string (""), nDialogID is used to identify the dialog resources. It is recommended that you use nDialogID rather than szDialogID to identify the dialog resource.

Note: If you created the dialog in the Dialogs view, the dialog is created with a string ID; therefore, you must specify this name as the szDialogID parameter to define the dialog.

If you override an existing dialog in the Dialogs view, the dialog has a numeric ID, and you must specify the ID in the nDialogID parameter.

If you want to use numeric IDs in all cases—which is what is recommended—you must edit the dialog in the Dialogs view to change the ISResourceID property of the created dialog to the desired Dialog ID instead of 0. Note that if you do this, the dialog name is no longer used when the dialog is created; it is used only in the Dialogs view in InstallShield to identify the dialog. The dialog is built with the correct numeric ID.

nReserved

Pass zero in this parameter. No other value is allowed.

hwndOwner

Specifies the window handle of the owner window. Specify HWND_INSTALL in this parameter to make the InstallShield main installation window the owner of the dialog.

lMsgLevel

This parameter specifies which windows messages will be send to the dialog. You must use the OR operator (|) to combine one of the following constants with the constant DLG_CENTERED.

DLG_MSG_STANDARD—Filters out most Windows messages; only those directly related to the dialog's controls are passed to the dialog.
DLG_MSG_ALL—Passes most Windows messages.

Return Values

DefineDialog Return Values

Return Value

Description

0

DefineDialog successfully defined the dialog.

DLG_ERR_ALREADY_EXISTS (-3)

You are trying to define a dialog already defined by DefineDialog. You cannot define two dialogs with the same name.

DLG_ERR (-1)

Indicates an unspecified error condition.

See Also