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 UserControl
s, TreeView
, ListView
, and ListViewGroup
s.
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:
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.