VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



.NET Framework - Check if Windows booted in Normal or Safe Mode

by Gehan Fernando (47 Submissions)
Category: Windows System Services
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Mon 18th April 2011
Date Added: Mon 8th February 2021
Rating: (1 Votes)

.NET Framework - Check if Windows booted in Normal or Safe Mode

API Declarations


using System.Windows.Forms;

Rate .NET Framework - Check if Windows booted in Normal or Safe Mode



{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            String msg;
            switch (SystemInformation.BootMode)
            {
                case BootMode.FailSafe:
                    msg = "The computer was booted using only the basic files and drivers." + Environment.NewLine +
                          "This is the same as Safe Mode.";
                    break;
                case BootMode.FailSafeWithNetwork:
                    msg = "The computer was booted using the basic files, drivers, and services necessary to start networking" + Environment.NewLine +
                          "This is the same as Safe Mode with Networking.";
                    break;
                default:
                    msg = "The computer was booted in Normal mode.";
                    break;

            }

            MessageBox.Show(msg, "Windows Mode", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
    }
}

Download this snippet    Add to My Saved Code

.NET Framework - Check if Windows booted in Normal or Safe Mode Comments

No comments have been posted about .NET Framework - Check if Windows booted in Normal or Safe Mode. Why not be the first to post a comment about .NET Framework - Check if Windows booted in Normal or Safe Mode.

Post your comment

Subject:
Message:
0/1000 characters