[RunInstaller(true)]
public partial class Installer1 : Installer
{
public Installer1()
{
InitializeComponent();
}
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
}
private void Installer1_AfterInstall(object sender, InstallEventArgs e)
{
Form1 topmostForm = new Form1();
topmostForm.BringToFront();
topmostForm.TopMost = true;
topmostForm.ShowDialog();
} }
I need to display the topmostForm in front of the default Windows Installer UI. The above is sample code inside my CustomAction that I am using to create a Form. Setting the TopMost property or using ShowDialog is not helping. Is there any other solution to make my form the top most and focussed?
Try the link below,
http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/158ad5bd-d3f7-4a21-8ebe-341e9741810a
You can use form option TopMost and Focus method. But there much better way. You can get installer process, then get it window handler and then use it as parameter in ShowDialog method::
WindowWrapper is something like this:
If you want to have complete control over installer user interface for branding or custom dialogs and don't want to use installer builder software like InstallShield then you can create a C++ application to serve as shell for Windows Installer - there is no need to implement installer actions such as copying files by yourself.
Windows Installer has API for such purpose. With function MsiSetExternalUIRecord you can provide a callback to capture installer notifications such as messages and progress updates.
Call
this.focus()
in yourform.OnLoad
method. That makes it show up in front of the installer. Simple fix.