Work for me:
: - , 3.5SP1, , .
1:
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Install(IDictionary stateSaver)
{
if (mycondition)
{
if (TopMostMessageBox.Show("body", "title", MessageBoxButtons.YesNo) == DialogResult.Yes)
System.Diagnostics.Process.Start("http://Microsoft FRW Link");
WindowHandler.Terminate();
}
else
base.Install(stateSaver);
}
2:
MessageBox ( , )
static public class TopMostMessageBox
{
static public DialogResult Show(string message)
{
return Show(message, string.Empty, MessageBoxButtons.OK);
}
static public DialogResult Show(string message, string title)
{
return Show(message, title, MessageBoxButtons.OK);
}
static public DialogResult Show(string message, string title,
MessageBoxButtons buttons)
{
Form topmostForm = new Form();
topmostForm.Size = new System.Drawing.Size(1, 1);
topmostForm.StartPosition = FormStartPosition.Manual;
System.Drawing.Rectangle rect = SystemInformation.VirtualScreen;
topmostForm.Location = new System.Drawing.Point(rect.Bottom + 10,
rect.Right + 10);
topmostForm.Show();
topmostForm.Focus();
topmostForm.BringToFront();
topmostForm.TopMost = true;
DialogResult result = MessageBox.Show(topmostForm, message, title,
buttons);
topmostForm.Dispose();
return result;
}
}
3:
msiexec
internal static class WindowHandler
{
internal static void Terminate()
{
var processes = Process.GetProcessesByName("msiexec").OrderBy(x => x.StartTime); \\DO NOT FORGET THE ORDERBY!!! It makes the msi processes killed in the right order
foreach (var process in processes)
{
var hWnd = process.MainWindowHandle.ToInt32();
ShowWindow(hWnd, 0);
try
{
process.Kill();
}
catch
{
}
}
}
[DllImport("User32")]
private static extern int ShowWindow(int hwnd, int nCmdShow);
}
;)