If you are using ProRibbon or any other library which is related to Windows Vista a program should stop working with a messagebox. The following snippet can be used to fullfill that task.
using System;
using System.Windows.Forms;
public static class VistaHelper
{
#region Enums
public enum CheckStartupExitCodes
{
Passed = 0,
Failed = -501,
}
#endregion
#region Public Methods and Operators
public static CheckStartupExitCodes CheckStartupArgs(bool showMessageBox = true, bool enableVisualStyles = true)
{
if (IsWinVistaOrHigher()) return CheckStartupExitCodes.Passed;
if (!showMessageBox) return CheckStartupExitCodes.Failed;
if (enableVisualStyles)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
}
MessageBox.Show("To run application you have to use Windows Vista or higher.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
return CheckStartupExitCodes.Failed;
}
#endregion
#region Methods
private static bool IsWinVistaOrHigher()
{
var os = Environment.OSVersion;
return (os.Platform == PlatformID.Win32NT) && (os.Version.Major >= 6);
}
#endregion
}
internal static class Program
{
#region Methods
[STAThread]
private static void Main(params string[] args)
{
//SQLiteConnection.ClearAllPools();
//SQLiteConnection.Shutdown(true, true);
//GC.Collect();
//GC.WaitForPendingFinalizers();
if (VistaHelper.CheckStartupArgs() != VistaHelper.CheckStartupExitCodes.Passed) return;
if (AdministratorHelper.CheckStartupArgs(args) != AdministratorHelper.CheckStartupExitCodes.Passed) return;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
}
#endregion
}