Adding a Print Button to a Dialog

InstallShield 2024

Project: This information applies to the Basic MSI projects.

In Basic MSI projects that are created in InstallShield X or later, the LicenseAgreement dialog includes a Print button. This button enables the end user to print the content of the dialog’s ScrollableText control. This button’s event executes the custom action ISPrint, which is included in a new Basic MSI project. Following are directions for adding a Print button to another dialog, and to an existing project that was created with InstallShield DevStudio 9.0 or earlier.

Adding a Print Button to Another Dialog

For the custom action ISPrint to work correctly with a dialog other than LicenseAgreement, you must set the value of the user-defined Windows Installer property IS_PRINT_DIALOG to the name of the dialog. (If IS_PRINT_DIALOG is not an existing property, ISPrint prints the content of the LicenseAgreement dialog’s ScrollableText control.)

To add a Print button to another dialog:

1. Create a button control in the dialog and optionally set its Text property to &Print. For details, see Editing Dialog Layout in Basic MSI Projects.
2. Add a DoAction event to the Print button, and in the event’s Action subsetting, select ISPrint. For details, see Triggering Control Events in Basic MSI Dialogs.
3. Modify the value of IS_PRINT_DIALOG from the events of the Back and Next buttons of the dialog and its next and previous dialogs:
a. Determine which dialog is displayed before the dialog to which you are adding a Print button. You can do this by either checking the argument of the NewDialog event for the dialog’s Back button, or viewing next dialog order in the expanded Custom Actions and Sequences view.
b. Add a SetProperty event. In the SetProperty setting, specify the following as the event condition:

1

c. In the Property Name setting, specify the following:

IS_PRINT_DIALOG

d. In the Value setting, specify the name of the dialog to which you are adding a Print button
e. If a Print button is included on any dialog that is displayed after the dialog to which you are adding a Print button, do the following:
i. Determine which dialog is displayed after the dialog to which you are adding a Print button. You can do this by either checking the argument of the NewDialog event for the dialog’s Next button, or viewing the next dialog order in the expanded Custom Actions and Sequences view.
ii. Add a SetProperty event to that next dialog’s Back button, and set its Property Name setting to IS_PRINT_DIALOG, and its Value setting to the name of the dialog to which you are adding a Print button.

If the next dialog does not have a Print button, or if it is the LicenseAgreement dialog, add a SetProperty event to the Next button of the dialog to which you are adding a Print button, and set its Property Name setting to IS_PRINT_DIALOG, and its Value setting to LicenseAgreement.

c. If a Print button is included on any dialog that is displayed before the dialog to which you are adding a Print button, and the previous dialog does not have a Print button or it is the LicenseAgreement dialog, add a SetProperty event to the Back button of the dialog to which you are adding a Print button, and set its Property Name setting to IS_PRINT_DIALOG, and its Value setting to LicenseAgreement.

Adding a Print Button to an Existing Project

To add a Print button to an existing project that was created with InstallShield DevStudio 9.0 or earlier:

1. Create the ISPrint custom action:
a. Launch the Custom Action Wizard.
b. In the Basic Information panel’s Name box, enter ISPrint.
c. In the Action Type panel’s Type box, select Call a function in a Windows Installer dynamic-link library.
d. In the Action Parameters panel, click the Browse button and browse to the file SetAllUsers.dll in the InstallShield folder’s Redist\Language Independent\i386 subfolder. Click Open.

If your project is configured to use path variables, InstallShield uses the predefined path variable <ISRedistPlatformDependentFolder> for part of the path.

e. In the Action Parameters panel’s Target box, enter PrintScrollableText.
f. Complete the wizard, accepting all remaining default settings.
2. Create a button control in the dialog and optionally set its Text property to &Print. For details, see Editing Dialog Layout in Basic MSI Projects.
3. Add a DoAction event to the Print button, and in the event’s Action subsetting, select ISPrint. For details, see Triggering Control Events in Basic MSI Dialogs.
4. Create the Windows Installer property IS_PRINT_DIALOG and set its value to the name of the dialog. For details, see Creating Properties in Windows Installer–Based Projects.

Note:If the ISPrint custom action is executed by a control event, the custom action’s logging information cannot be recorded to the installer log in the usual manner (because of a Windows Installer limitation); the information is logged to the values of properties that have the form ISPrintLogmNoten.