Click here to Skip to main content
Click here to Skip to main content

Everything you want to know about your computer with System Information II

, 21 Mar 2010
Rate this:
Please Sign up or sign in to vote.
VB.NET program provides information about your hardware and operating system
SystemInformation2EventViewer.jpg

Introduction

I've always been interested in the technical details of the computer I'm using. I know how to find out most of the details of the hardware and operating system using various utility programs, but I wanted to write a program that would give me that information using the .NET Framework to obtain most of the information. I started writing this utility several years ago in VB.NET and this version is the result of several revisions and additions.

This utility offers, in addition to information, the ability to control the information displayed. You can start/stop drivers and service, uninstall programs, control processes, set OEM computer information including logo/picture, share/unshare folders, delete startup programs, and modify user/company information.

The complete list of categories is Bios, Components, Computer, CPU, DateAndTime, Desktop, Drivers, Drives, EnvironmentVariables, EventViewer, FileTypes, Fonts, InstalledPrograms, Introduction, Keyboard, MultimediaCodecs, Network, OEMInformation, OperatingSystem, PointingDevice, Ports, Processes, Services, Shares, Sound, SpecialFolders, StartupPrograms, UsbDevices, UserInformation, Video, VisualStyles, Win32Explorer Hardware, Win32Explorer Memory, Win32Explorer Network, Win32Explorer Storage, Win32Explorer System, and Win32Explorer Users.

By examining the source code, this application will familiarize the reader with .NET WMI class methods, Panels used as UserControls, TreeView, ListView, and ListViewGroups.

Design

Each information category is implemented as a user control that contains both a panel with the user interface and the code for that category. A treeview control is used to select each category and the user control panel is added to a split container in the main form. This makes it easy to add or revise the information categories as each one almost functions as a separate program. Many of the user controls (panels) are dependent upon a large class called "ComputerInformation" that contain much of the logic in the program. This large class is a relic of previous versions. In a future revision, I'd like to divide this class into smaller classes for each information category.

Using the Code

I've tried to be as neat and consistent as possible. I've also tried to use descriptive names for controls and variables. There are also quite a few comments in the code.

Adding The User Controls To The Split Container:

' Display the correct panel based on the node that was selected.
Private Sub TreeviewSystemInfo_AfterSelect(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.TreeViewEventArgs) _
			Handles TreeViewSystemInfo.AfterSelect
    Select Case e.Node.Text
        Case "Computer"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Computer.CreateInstance())
        Case "CPU"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Cpu.CreateInstance())
        Case "BIOS"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Bios.CreateInstance())
        Case "Drives and Volumes"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Drives.CreateInstance())
        Case "Network"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Network.CreateInstance())
        Case "Sound"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Sound.CreateInstance())
        Case "Video"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Video.CreateInstance())
        Case "Operating System"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add_
			(OperatingSystem.CreateInstance())
        Case "Date and Time"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(DateAndTime.CreateInstance())
        Case "Installed Programs"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add_
			(InstalledPrograms.CreateInstance())
        Case "Services"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Services.CreateInstance())
        Case "Startup Programs"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add_
			(StartupPrograms.CreateInstance())
        Case "Special Folders"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(SpecialFolders.CreateInstance())
        Case "Environment Variables"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add_
			(EnvironmentVariables.CreateInstance())
        Case "OEM Information"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(OemInformation.CreateInstance())
        Case "Processes"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Processes.CreateInstance())
        Case "User Information"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add_
			(UserInformation.CreateInstance())
        Case "Visual Styles"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(VisualStyles.CreateInstance())
        Case "Fonts"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Fonts.CreateInstance())
        Case "Event Viewer"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(EventViewer.CreateInstance())
        Case "Drivers"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Drivers.CreateInstance())
        Case "Components"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Component.CreateInstance())
        Case "Shares"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Shares.CreateInstance())
        Case "File Types"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(FileTypes.CreateInstance)
        Case "Keyboard"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Keyboard.CreateInstance())
        Case "Pointing Device"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(PointingDevice.CreateInstance())
        Case "Multimedia Codecs"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add_
			(MultimediaCodecs.CreateInstance())
        Case "Desktop"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Desktop.CreateInstance())
        Case "USB Devices"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(UsbDevices.CreateInstance())
        Case "Ports"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Ports.CreateInstance())
        Case "Win32 Hardware"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Win32Hardware.CreateInstance())
        Case "Win32 Storage"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Win32Storage.CreateInstance())
        Case "Win32 Memory"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Win32Memory.CreateInstance())
        Case "Win32 System"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Win32System.CreateInstance())
        Case "Win32 Network"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Win32Network.CreateInstance())
        Case "Win32 Users"
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Win32Users.CreateInstance())
        Case Else
            SplitContainerSystemInfo.Panel2.Controls.Clear()
            SplitContainerSystemInfo.Panel2.Controls.Add(Introduction.CreateInstance())
    End Select

Conclusion

I hope you find this program useful not only for finding out information about your computer but also for finding code that you can use to extract or change that information. Suggestions for additions to the categories are always welcome. Also any suggestions as to how I can improve this code will be appreciated.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

hswear3
Web Developer
United States United States
I started programming by writing BIOS code in Z80 assembler for custom computers I was assembling way back in 1978. They had 5 MB hard drives that cost over $1000!
 
I haven't touched assembler in years. These days I write code in C# or VB. I've written a lot of utility programs as learning experiences. But what little money I make from programming comes from writing radio broadcast automation software.

Comments and Discussions

 
GeneralMy vote of 5 PinmemberChintanhiremath14-Feb-12 18:15 
QuestionSMBios version question Pinmembercoder11229-Nov-11 13:31 
GeneralMy vote of 5 Pinmembercoder11217-Oct-11 12:00 
GeneralWoW Pinmemberaaroncampf9-Dec-10 20:52 
GeneralThis would be even better if it would support remote connection! PinmemberAlexCode16-Sep-10 8:22 
GeneralVery nice as usual :) PinmemberJason Vetter14-Apr-10 8:44 
GeneralError: WAN-Miniport (IP) PinmemberTheooo30-Mar-10 5:21 
GeneralRe: Error: WAN-Miniport (IP) Pinmemberhswear330-Mar-10 5:35 
GeneralAwesome Pinmembersuresh suthar25-Mar-10 20:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 22 Mar 2010
Article Copyright 2010 by hswear3
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid