I want to show a dialog to the user that says "this is going to be removed with this installation" and if "YES" or "OK" is pressed, then the installation can continue; otherwise, I want to abort it.
Therefore I have defined a custom action (run vbscript) like this:
<CustomAction Id="ShowUninstallInformationDlg" Impersonate="yes" Return="check" Execute="immediate" BinaryKey="ShowUninstallInformationDlg.vb" VBScriptCall=""/>
<Binary Id="ShowUninstallInformationDlg.vb" SourceFile="c:\myscripts\installer\ShowUninstallInformationDlg.vbs"/>
<InstallExecuteSequence>
<Custom Action="ShowUninstallInformationDlg" After="FindRelatedProducts">NOT Installed AND NOT PATCH AND NOT MYPRODUCT_ANYVERSION=""</Custom>
</InstallExecuteSequence>
VBSCRIPT (ShowUninstallInformationDlg.vbs):
'ShowUninstallInformationDlg
Option Explicit
Dim text
Dim productName
Dim rec
productName = Session.Property("ProductName")
text = "The following installations are going to be removed with the installation of " & productName & ":"
If Session.Property("MYPRODUCT_ANYVERSION") <> "" Then
text = text & "\n * MyOtherProduct (any version)"
End If
Set rec = Session.Installer.CreateRecord(1)
rec.StringData(0) = text
Session.Message &H0B000034, rec
The kind "&H0B000034" I am using as "Session.Message" argument is from an example from the MSDN, see http://msdn.microsoft.com/en-us/library/windows/desktop/aa371672(v=vs.85).aspx.
Always the script is being executed I get the following error in my MSI log:
Error 1720. There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action ShowUninstallInformationDlg script error -2147467259, Msi API Error: Message,Kind,Record Line 19, Column 1,
I have searched google massively for examples using Session.Message, but with no succeeding results... Can anyone help? Thanks!