Click here to Skip to main content
15,888,401 members
Articles / Desktop Programming / MFC
Article

System Information

Rate me:
Please Sign up or sign in to vote.
4.58/5 (55 votes)
19 Aug 20032 min read 471.5K   17.9K   154   131
Obtaining Information from Computer Hardware/Software

Screen shot of program

Introduction

This program shows you a very simple way to determine your PC hardware and software. It queries operating system for the following Hardware/Software:

  • Operating System Version (Thanks to PJ Naughter)
  • Computer Name
  • IP Address of Computer
  • User Name
  • Internet Explorer Version
  • Total RAM
  • Free Memory
  • Number of Hard Disk Drives
  • Hard Disk Total Space/Free Space/Used Space
  • CDROM Drives
  • Monitor Resolution
  • Color Depth
  • Number of CPUs (Thanks to Iain Chesworth)
  • CPU Speed
  • CPU Identifier
  • CPU Vendor Identifier
  • Operating System Folder
  • System Folder

Program structure

By clicking the combo box and changing it's item, selected item is determined and it's ID passed to Process member function of dialog. The Process member function takes ID of query and returns the proper result. Body of Process has a lot of code to prepares result and if any error has occurred, the error string will be returned.

How to use

Add the following header and implementation files to your project:
  • cup_info.h, cpu_info.cpp: For CPU Information like Speed, ID, Vendor ID,...
  • dtwinver.h, dtwinver.cpp: For Operating System Version (e.g. Build Number and Service Packs)
  • SysInfoDefs.h, SysInfoDefs.cpp: For General System Information like Total RAM, Number of Hard Disk Drives, Disk Space/Free Space/Used Space
  • SmartDef.h: For IDE S.M.A.R.T. commands to query from IDE hard disks that support SMART.

Functions

Below table shows all functions that are used to determine Hardware/Software of the computer.

CString DetermineIEVer();Determining Internet Explorer Version (Build Number)
CString QueryHardDisks();Calculating Number of Hard Disks and Number of Cylinders, Tracks per Cylinders, Sectors per Tracks, Bytes per Sector and Total Capacity for each Hard Disks
CString QueryDriveSpace();Calculating Drive Space/Free Space/Used Space of All Hard Drives
CString QueryCDDrive();Determining Number of CD Drives
CString QueryTotalRAM()Calculating Total Physical RAM (Random Access Memory)
CString QueryFreeRAM();Calculating Free Physical Memory
CString QueryUserName()User Name of current user
CString QueryComputerName();Computer Name
CString QueryCPUInfo();Number of CPU Installed on Mother Board
CString QueryCPUSpeed();Speed of each CPU
CString QueryCPUID();ID of each CPU
CString QueryCPUVendorID();ID of CPU Vendor
CString QueryResolution();Calculating Monitor Resolution in Pixel
CString QueryPixelDepth();Calculating Color Depth of any Pixel
CString QueryOS();Determining Operating System Version (Build Number) and it's Service Pack
CString QueryLocalIPAddress();Determining IP Address of Computer
CString QueryHDDSmartCommand();Query IDE hard disks that support SMART (Self-Monitoring Analysis & Reporting Technology).
CString QueryDirectory(char* sFolder,int iFolder);Determining Full Path of Specified Folder where sFolder is Folder Name and iFolder is Folder Shell ID Number
CString GetCommandError();Determining last occurred error

Requirements

  • Latest Platform SDK
  • Visual Studio 6.0 with service pack 5

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
CEO Solaris Electronics LLC
United Arab Emirates United Arab Emirates
I was born in Shiraz, a very beautiful famous city in Iran. I started programming when I was 12 years old with GWBASIC. Since now, I worked with various programming languages from Basic, Foxpro, C/C++, Visual Basic, Pascal to MATLAB and now Visual C++.
I graduated from Iran University of Science & Technology in Communication Eng., and now work as a system programmer for a telecommunication industry.
I wrote several programs and drivers for Synthesizers, Power Amplifiers, GPIB, GPS devices, Radio cards, Data Acquisition cards and so many related devices.
I'm author of several books like Learning C (primary and advanced), Learning Visual Basic, API application for VB, Teach Yourself Object Oriented Programming (OOP) and etc.
I'm winner of January, May, August 2003 and April 2005 best article of month competition, my articles are:


You can see list of my articles, by clicking here


Comments and Discussions

 
GeneralMainboard Information not available in Win2K and Win98 on using WMI Pin
gayatrisk2-Dec-03 23:16
gayatrisk2-Dec-03 23:16 
GeneralRe: Mainboard Information not available in Win2K and Win98 on using WMI Pin
Abbas_Riazi3-Dec-03 0:39
professionalAbbas_Riazi3-Dec-03 0:39 
QuestionHow can i get the Mainboard's Serial number? Pin
Shuang. Wu24-Nov-03 20:20
Shuang. Wu24-Nov-03 20:20 
AnswerRe: How can i get the Mainboard's Serial number? Pin
Abbas_Riazi24-Nov-03 22:03
professionalAbbas_Riazi24-Nov-03 22:03 
GeneralRe: How can i get the Mainboard's Serial number? Pin
Shuang. Wu25-Nov-03 13:36
Shuang. Wu25-Nov-03 13:36 
GeneralCompiler errors Pin
Hekmatyar915-Nov-03 8:40
Hekmatyar915-Nov-03 8:40 
GeneralRe: Compiler errors Pin
Abbas_Riazi15-Nov-03 20:26
professionalAbbas_Riazi15-Nov-03 20:26 
GeneralRe: Compiler errors Pin
giannib2k28-Mar-08 4:35
giannib2k28-Mar-08 4:35 
GeneralMainboard Pin
Delikan11-Nov-03 3:51
Delikan11-Nov-03 3:51 
GeneralRe: Mainboard Pin
Abbas_Riazi11-Nov-03 17:52
professionalAbbas_Riazi11-Nov-03 17:52 
GeneralRe: Mainboard Pin
Anonymous25-Nov-03 2:11
Anonymous25-Nov-03 2:11 
GeneralRe: Mainboard Pin
Abbas_Riazi25-Nov-03 2:54
professionalAbbas_Riazi25-Nov-03 2:54 
GeneralDVD drive detection... Pin
RNavarette7-Nov-03 10:26
RNavarette7-Nov-03 10:26 
GeneralRe: DVD drive detection... Pin
Abbas_Riazi7-Nov-03 19:20
professionalAbbas_Riazi7-Nov-03 19:20 
GeneralRe: DVD drive detection... Pin
taishan_sword16-Dec-03 22:10
taishan_sword16-Dec-03 22:10 
GeneralEHEM>....... Pin
Snyp20-Aug-03 5:53
Snyp20-Aug-03 5:53 
GeneralRe: EHEM>....... Pin
Abbas_Riazi20-Aug-03 5:59
professionalAbbas_Riazi20-Aug-03 5:59 
GeneralRe: EHEM>....... Pin
billgatest20-Aug-03 5:59
billgatest20-Aug-03 5:59 
GeneralRe: EHEM>....... Pin
diilbert22-Aug-03 15:12
diilbert22-Aug-03 15:12 
GeneralRe: EHEM>....... Pin
guard200220-Aug-03 22:21
guard200220-Aug-03 22:21 
GeneralRe: EHEM>....... Pin
guard200220-Aug-03 23:01
guard200220-Aug-03 23:01 
GeneralPlease Contact me Pin
Mahmoud Komeily11-Aug-03 9:55
Mahmoud Komeily11-Aug-03 9:55 
GeneralReading CPU Temperature from VB or VC project Pin
Faisal_tuhh8-Aug-03 4:43
Faisal_tuhh8-Aug-03 4:43 
GeneralRe: Reading CPU Temperature from VB or VC project Pin
Abbas_Riazi20-Aug-03 2:52
professionalAbbas_Riazi20-Aug-03 2:52 
GeneralGreat work, problem with WinNT Pin
Manfred Staiger1-Jul-03 1:55
Manfred Staiger1-Jul-03 1:55 

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

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