This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Custom action (Managed DLL), is it possible show MessageBox as modal dialog ?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
May 03, 2012
08:36 AM
Custom action (Managed DLL), is it possible show MessageBox as modal dialog ?
Hi, everyone.
I created a simple project. To the section custom action I added managed dll, inside this dll I call "MessageBox"
But, when I install this package my Message Box appears in the toolbar. Please, check the attachments.
Does it exist the way to show it on the screen?
I created a simple project. To the section custom action I added managed dll, inside this dll I call "MessageBox"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ClassLibrary1
{
public class Class1
{
string message;
string param;
public Class1()
{
message = "Test";
}
public string getMessage(string param)
{
this.param = param;
MessageBox.Show("message " + message + "param " + param);
return message;
}
public void getMessage2(string param)
{
MessageBox.Show("message " + message + "param " + param);
}
}
}
But, when I install this package my Message Box appears in the toolbar. Please, check the attachments.
Does it exist the way to show it on the screen?
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
May 07, 2012
02:15 PM
For a message box to parent to a window correctly, it needs a handle to the window that should be its parent. However, Windows Installer does not provide a handle to the window for the running installation. You can try to find the window with FindWindow, but this becomes quite difficult when the basic UI is displayed by MSI (the window then has a generic dialog class making it very possible that the wrong window will be found).
An alternate method of displaying a message is available through the MsiProcessMessage API when specifying the INSTALLMESSAGE_USER message type (the type can be OR'ed with message box flag values such as MB_OK). This will allow for displaying a message through MSI which eliminates the need to worry about what window to parent to. One thing to note, though, is that MsiProcessMessage will not display any messages when the installation is running silently.
An alternate method of displaying a message is available through the MsiProcessMessage API when specifying the INSTALLMESSAGE_USER message type (the type can be OR'ed with message box flag values such as MB_OK). This will allow for displaying a message through MSI which eliminates the need to worry about what window to parent to. One thing to note, though, is that MsiProcessMessage will not display any messages when the installation is running silently.
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)