I'm updating an InstallShield based installer. I've added a new managed custom action, written in C#, and packaged using Wix DTF. Action is invoked correctly, and performs necessary actions.
Problem I have is showing an error message to user.
Method 1: MsiProcessMessage
From articles I've read, I understood that MsiProcessMessage
is the correct way to do it, however this method does not work in UI sequence (before setup actually starts copying files and modifying system). In install sequence this method works. Code which I use is following:
Record record = new Record() { FormatString = "Password is not valid for this user." };
session.Message(
InstallMessage.Error | (InstallMessage)(MessageBoxIcon.Error) | (InstallMessage)MessageBoxButtons.OK,
record
);
Is it actually impossible to show an error message in UI sequence (Immediate execution) using MsiProcessMessage
?
Method 2: MessageBox.Show
Using Windows.Forms
works for showing a message box. However, message is displayed in background of setup wizard, and shows a separate icon in Windows taskbar.
Is there a way to get window handle of installation wizard, and that way solve this problem?