Click here to Skip to main content
15,886,008 members
Articles / Desktop Programming / MFC

Reusable System Information Component

Rate me:
Please Sign up or sign in to vote.
1.00/5 (11 votes)
2 Sep 20023 min read 67.2K   1.5K   25  
A reusable .NET component, which retrieves the operating system information.
using System.Windows.Forms;
using System.ComponentModel;

namespace SysInfoLib
{
public class SysInfo: Component{

public SysInfo(){}
   
  public string UserName
   {
      get
      {
         return SystemInformation.UserName;
      }
   }

 public string ComputerName
   {
      get
      {
         return SystemInformation.ComputerName;
      }
   }

 public string Network
   {
      get
      {
         if(SystemInformation.Network)
         return "Connected";
         else
         return "Disconnected";
            
      }
   }

 public string MonitorInfo
   {
      get
      {
         return SystemInformation.MonitorCount.ToString();
      }
   }

 public string MouseInfo
   {
      get
      {

	if(SystemInformation.MousePresent)
          {
           return SystemInformation.MouseButtons.ToString() + " Button Mouse";

           }
          else
          return "No Mouse Connected";
         
      }
   }

 public string BootInfo
   {
      get
      {

          if(SystemInformation.BootMode==BootMode.Normal)
            return "Normal";
          else if(SystemInformation.BootMode==BootMode.FailSafe)
            return "Started In Safe Mode";
          else if(SystemInformation.BootMode==BootMode.FailSafeWithNetwork)
             return "Started In Safe Mode with Network Support";
          else 
             return "No info";

      }
   }
}
   
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Architect
United States United States
Chandra Hundigam-Venkat has Master degree in Computer Application, Microsoft Certified Professional and Cloud & Software Architect. Significantly involved in Cloud solutions, Cloud native application, Cloud migration, Enterprise application development distributed object oriented system development. Started computer career at the early age of eighteen as an intern in computer labs and had the opportunity to work with various USA fortune 500 companies in various technology and leadership roles.


Comments and Discussions