You can use the TopMost and Focus form options. But there is a much better way. You can get the installation process, then get its window handler, and then use it as a parameter in the ShowDialog :: method
var proc = Process.GetProcessesByName("msiexec").FirstOrDefault(p => p.MainWindowTitle == "Name of product"); var formResult = proc != null ? form.ShowDialog(new WindowWrapper(proc.MainWindowHandle)) : form.ShowDialog();
WindowWrapper looks something like this:
public class WindowWrapper : IWin32Window { private readonly IntPtr hwnd; public IntPtr Handle { get { return hwnd; } } public WindowWrapper(IntPtr handle) { hwnd = handle; } }
Pavel belov
source share