Answer
This guide will explain how to display a message box using the "Message Box" Custom Action
On the Custom Actions page, right click where you
want to add your message box, then from the context menu select "Add
Predefined Custom Action"->"Message Box"
Parameters for this custom action must be placed in the "Action Data" field. Data in the "Action Data" field must be placed in the following format:
MessageBody | MessageTitle | Type | OutputPropertyName | ParentProcessId
The parameters have the following meaning:
- MessageBody - This is the message that will appear in
the message box.
It supports the following sequences of special characters: '\n' (new line character), '\\' (backslash character), '\|' (pipe character) - MessageTitle - This is the message box's
title.
It supports '\\' and '\|' - Type - These are options that set the type of the
message box.
This parameter can be any combination of uTypes listed on the MSDN documentation for MessageBox, separated by ',' - OutputPropertyName This is the name of the property
that will be set to different values depending on which button on the
message box the user will press.
The property will be set to one of the following values:
| IDABORT | Abort button was selected. |
| IDCANCEL | Cancel button was selected. |
| IDCONTINUE | Continue button was selected. |
| IDIGNORE | Ignore button was selected. |
| IDNO | No button was selected. |
| IDOK | OK button was selected. |
| IDRETRY | Retry button was selected. |
| IDTRYAGAIN | Try Again button was selected. |
| IDYES | Yes button was selected. |
- ParentProcessId - This parameter is mainly intended
to be set to [CLIENTPROCESSID].
Doing so will make the message box a child to the Windows Installer's dialog
Example usage:
Hello, this is a test.\nContinue with install? | Title | MB_YESNO , MB_SETFOREGROUND , MB_ICONQUESTION | MYRESULTPROPERTY | [CLIENTPROCESSID]
This will display a message box, set the message box to the foreground, and upon pressing 'Yes' or 'No', it will set [MYRESULTPROPERTY] to the proper value.
Omitting an optional parameter:
Let us assume we have no need for a result property. The proper syntax for Action Data is:
Hello, this is a test.\nContinue with install? | Title | MB_YESNO , MB_SETFOREGROUND , MB_ICONQUESTION | | [CLIENTPROCESSID]
Note the two consecutive pipe characters indicating that a parameter has been omitted
Note that all parameters are optional and, if left empty, the
texts will be set to default values. You can for example omit the
<Type> parameter
The following aspects should be taken into consideration when
using this custom action:
- when set to Deferred, the fourth
parameter can not be used. Deferred custom actions can not set
properties
- when placed under "UI Custom Actions", the custom
action's parameters must be stored in the CustomActionData property.
This must be done using a Control Events published event, placed right above the DoAction published event
that launches MessageBox.