Hello
How can we detect which processor and how many RAM are included inside the PC (for example : Pentium II 233 MHz, 64 Mb of RAM) ?
Thank you in advance for your help.
Printable View
Hello
How can we detect which processor and how many RAM are included inside the PC (for example : Pentium II 233 MHz, 64 Mb of RAM) ?
Thank you in advance for your help.
Try the GetSystemInfo API Function:
Code:Private Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO)
Private Type SYSTEM_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOrfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
dwReserved As Long
End Type
Private Sub Form_Load()
Dim SInfo As SYSTEM_INFO
'Set the graphical mode to persistent
Me.AutoRedraw = True
'Get the system information
GetSystemInfo SInfo
'Print it to the form
Me.Print "Number of procesor:" + str$(SInfo.dwNumberOrfProcessors)
Me.Print "Processor:" + str$(SInfo.dwProcessorType)
Me.Print "Low memory address:" + str$(SInfo.lpMinimumApplicationAddress)
Me.Print "High memory address:" + str$(SInfo.lpMaximumApplicationAddress)
End Sub
Thank you !
But I need :
Microprocessor : the rated in MHz.
RAM : the memory in Méga Bytes.
Thank you in advance for your answer.
It is very easy to get the ammount of RAM:
Code:Private Type MEMORYSTATUS
dwLength As Long
dwMemoryLoad As Long
dwTotalPhys As Long
dwAvailPhys As Long
dwTotalPageFile As Long
dwAvailPageFile As Long
dwTotalVirtual As Long
dwAvailVirtual As Long
End Type
Private Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As MEMORYSTATUS)
Private Sub Form_Load()
Dim MemStat As MEMORYSTATUS
'retrieve the memory status
GlobalMemoryStatus MemStat
MsgBox "You have" + Str$(MemStat.dwTotalPhys / 1024) + " Kb total memory and" + Str$(MemStat.dwAvailPageFile / 1024) + " Kb available PageFile memory."
End Sub
Many thanks
What about the processor rate (I need this info such as 233 MHz for example).
Thank you again.
I've got a lot of [frustrating] experience with this, and in VB there's only one way to get the processor mHz, and it *only* works in Windows NT and 2000.
The processor info is stored in the registry:
HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0
From there, you can get info like mHz. You can't get something like "Pentium II", but the Family/Model/Stepping information is there, and there's a way to figure out what processor type it is from that, but I never found a reliable way.