System Hardware Information Finder
Posted
by Naveen K Kohli
on February 8th, 1999
CPU Information:
To get CPU information I could not find any direct and simple API call. Then I thought of our friendly Registry, which contains all the system information. And there it was all the information I wanted. If you look under HKEY_LOCAL_MACHINE/Hardware/Description/System/CentralProcessor/0 key in registry, you will find the answers to your questions. ~MHz subkey gives the CPU speed and VendorIdentifier gives the vendor information. We will make use of RegQueryValueEx API call to get the information.LONG RegQueryValueEx( HKEY hKey, // handle to key to query LPTSTR lpValueName, // address of name of value to query LPDWORD lpReserved, // reserved LPDWORD lpType, // address of buffer for value type LPBYTE lpData, // address of data buffer LPDWORD lpcbData // address of data buffer size );Before making this call, it is necessary to create the handle to registry key which needs to be queried. For this make use of RegCreateKeyEx API call.
This is how the code looks like in the included code for this utility.
// Get the processor speed info.
result = ::RegOpenKeyEx (HKEY_LOCAL_MACHINE,
"Hardware\\Description\\System\\CentralProcessor\\0", 0, KEY_QUERY_VALUE, &hKey);
// Check if the function has succeeded.
if (result == ERROR_SUCCESS) {
result = ::RegQueryValueEx (hKey, _T("~MHz"), NULL, NULL,
(LPBYTE)&data, &dataSize);
m_stCPUSpeed.Format ("%d", data);
m_stCPUSpeed += _T (" MHz");
dataSize = sizeof (vendorData);
result = ::RegQueryValueEx (hKey, _T("VendorIdentifier"), NULL, NULL,
(LPBYTE)vendorData, &dataSize);
m_stVendorInfo.Format ("%s", vendorData);
}
// Make sure to close the reg key
RegCloseKey (hKey);
Since I don't have access to any other CPU than Intel. So I couldn't test this code on CPU's from Cyrix, AMD, etc.
Physical Memory Status:
To get the information about the memory status of the system we can take routes. First one, which is not easy for a person who does not know assembly language, involves getting the required information from CMOS data. Second one which simply involves making GlobalMemoryStatus API call. And I chose the second one (Ofcourse I am not assembly language pro).VOID GlobalMemoryStatus ( LPMEMORYSTATUS lpBuffer // pointer to the memory status structure );The information is returned in MEMORYSTATUS data structure.
typedef struct _MEMORYSTATUS { // mst
DWORD dwLength; // sizeof(MEMORYSTATUS)
DWORD dwMemoryLoad; // percent of memory in use
DWORD dwTotalPhys; // bytes of physical memory
DWORD dwAvailPhys; // free physical memory bytes
DWORD dwTotalPageFile; // bytes of paging file
DWORD dwAvailPageFile; // free bytes of paging file
DWORD dwTotalVirtual; // user bytes of address space
DWORD dwAvailVirtual; // free user bytes
} MEMORYSTATUS, *LPMEMORYSTATUS;
The information returned by the GlobalMemoryStatus function is volatile. There is no guarantee that two sequential calls to this function will return the same information. This API call has been made in GetMemoryInfo function of the application attached. I gets the information for memory usage, total physical memory instaled, physical memory available, and total virtual memory.

Comments
Hidden Icon at VNC Software Informer
Posted by iconuf.com on 12/12/2012 10:44amBy WebOsPublisher Download free 'Up arrow ' icon in transparent PNG or icon in different sizes and in best quality Up arrow : Icons and PNG image on icones.pro Chercher en franЧaisfr Search in englishen Buscar en espaбoles Cerca in italianoit Suche auf Deutschde Search Size : All the sizes at least 256px at least 128px at least 96px at least 64px at least 48px at least 32px Commercial use : Yes Whatever Colors : Add the filter black Add the filter grey Add the filter white Add the filter yellow Add the filter orange Add the filter red Add the filter pink Add the filter purple Add the filter blue Add the filter green -- iconsFarm-Fresh Web IconsUp arrow icon background color : size : 32px x 32px weight : 0.65 Ko 16px x 16px About this icon Author : FatCow Pack : Farm-Fresh Web Icons Views : 111 views Rate : Loading ... Download Download Copyright Licence : Creative Commons Commercial use : No (you can contact the author to apply). The related icons on : All the icons on 'Up arrow ' The icons of the pack Farm-Fresh Web Icons : All icons in this pack Farm-Fresh Web Icons Some related terms icon arrow, icon auxiliary, icon basic tops, icon below, icon common, icon dart, icon dominant, icon elegant, icon elevated, icon eminent, icon erect, icon first, icon head, icon head low, icon height, icon high, icon important, icon javelin, icon lance, icon low, icon noble, icon part, icon peak, icon reduced, icon reigning above, icon ridge eminence, icon rule, icon Saget, icon secondary, icon set, icon short, icon small, icon spear, icon spire height, icon summit, icon superior, icon superiority, icon top, icon transcendental, icon up, icon upper, icon vulgar About вâÐ Help вâÐ Contact вâÐ Suggest your icons вâÐ The most searched вâÐ expЩrience utilisateur вâÐ Follow @FredCozic Fan on Facebook Twitter -- :: Щ 2009-2012 Icones.pro вâÐ Designed and developed by FrЩdЩric Cozic and edited by Ligorus ::
Replysugestion
Posted by Dropfish on 08/29/2004 11:49pmit will be much better if u implement the getSysInformation inside the CSysInformation but the CXXXdlg
ReplySystem Information
Posted by chandra.mohan on 08/11/2004 01:08amWhich API return the CPU serial Number?
Posted by Legacy on 02/21/2004 12:00amOriginally posted by: Shaghayegh
ReplyBIOS
Posted by Legacy on 02/17/2004 12:00amOriginally posted by: Meena
I want to write a code in vb that would read the DMI information in BIOS. Could anyone help me? Thank You.
Reply- Meena.
hardware configuration & installed softwares information using MFC
Posted by Legacy on 02/09/2004 12:00amOriginally posted by: Ajit
Replyhow to retrive info from registry in jsp
Posted by Legacy on 01/21/2004 12:00amOriginally posted by: Indu
iam indu iam doing a project
Replyin which i have to retrive info of hardware & software of systems in a Lan igot some functions like
RegQueryValueEx()
RegOpenKeyEx()...etc but not able to use then appropriately
can u plz help!.
Get me unique hardware identifier
Posted by Legacy on 01/08/2004 12:00amOriginally posted by: Philip Jacob
Development on VB 6.0
ReplyWe are aware of GetVolumeInformation Win32 API and found it is not physical serial number embedded in the hardware units.
we will appreciate any suggestions to obtain a unique hardware identifer through API.
multitasking in c programming
Posted by Legacy on 01/01/2004 12:00amOriginally posted by: rajendra
ReplyI want source code for multitasking in c programming
Plese if u know something send me mail on id .
Disable/Enable Hardware Acceleration..
Posted by Legacy on 12/10/2003 12:00amOriginally posted by: Dillip
Hi.!,
How do I Enable/Disable Hardware Acceleration of Display card programmatically available under Display Properties->Settings->Advanced->Troubleshooting..?
Any code snipte would be highly appreciated.!
Thanks & Regards.,
ReplyDILLIP.
Loading, Please Wait ...