Messagebox appearing behind uninstaller
-
So I am trying to give the user an option of removing registry keys when uninstalling my application (the installer is the windows installer with visual studio). The problem is it appears the message box appears behind the uninstaller (sometimes). Here is what I am doing:
public CustomInstaller() : base() { InitializeComponent(); base.AfterUninstall += new InstallEventHandler(CustomInstaller\_AfterUninstall); } public override void Uninstall(IDictionary savedState) { base.Uninstall(savedState); } void CustomInstaller\_AfterUninstall(object sender, InstallEventArgs e) { // Ask to remove settings DialogResult result = MessageBox.Show("Do you want to remove all settings? (This is not reversible)", "Remove Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { try { Registry.LocalMachine.DeleteSubKeyTree(@"Software\\JD Development"); } catch (Exception ex) { MessageBox.Show("Unable to remove registry settings: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } // Delete the service Process.Start("sc", "delete JDAgent"); }
-
So I am trying to give the user an option of removing registry keys when uninstalling my application (the installer is the windows installer with visual studio). The problem is it appears the message box appears behind the uninstaller (sometimes). Here is what I am doing:
public CustomInstaller() : base() { InitializeComponent(); base.AfterUninstall += new InstallEventHandler(CustomInstaller\_AfterUninstall); } public override void Uninstall(IDictionary savedState) { base.Uninstall(savedState); } void CustomInstaller\_AfterUninstall(object sender, InstallEventArgs e) { // Ask to remove settings DialogResult result = MessageBox.Show("Do you want to remove all settings? (This is not reversible)", "Remove Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { try { Registry.LocalMachine.DeleteSubKeyTree(@"Software\\JD Development"); } catch (Exception ex) { MessageBox.Show("Unable to remove registry settings: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } // Delete the service Process.Start("sc", "delete JDAgent"); }
I googled (you can do this too) and found some solutions: 1.:
MessageBox.Show(new Form(){TopMost = true},"I'm still on top, YEAH");
2.: TopMost MessageBox[^] 3.:
[DllImport("user32.dll")]
public static extern int MessageBox(int hWnd, String text, String caption, uint type);Then just call MessageBox with MB_TOPMOST
-
I googled (you can do this too) and found some solutions: 1.:
MessageBox.Show(new Form(){TopMost = true},"I'm still on top, YEAH");
2.: TopMost MessageBox[^] 3.:
[DllImport("user32.dll")]
public static extern int MessageBox(int hWnd, String text, String caption, uint type);Then just call MessageBox with MB_TOPMOST
Yeah I was working on this late night and didn't find anything. Just had my wording screwed up in my search parameters instead of just top most messagebox. I dunno. Thanks for the reply.