|
-
May 21st, 2001, 06:10 AM
#1
Thread Starter
Member
Detect microprocessor and RAM
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.
-
May 21st, 2001, 06:29 AM
#2
Frenzied Member
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
-
May 21st, 2001, 07:15 AM
#3
Thread Starter
Member
Detect processor in MHz and RAM in Mb
Thank you !
But I need :
Microprocessor : the rated in MHz.
RAM : the memory in Méga Bytes.
Thank you in advance for your answer.
-
May 21st, 2001, 08:15 AM
#4
Frenzied Member
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
-
May 21st, 2001, 08:28 AM
#5
Thread Starter
Member
Get processor rate
Many thanks
What about the processor rate (I need this info such as 233 MHz for example).
Thank you again.
-
May 21st, 2001, 09:09 AM
#6
Addicted Member
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.
Things I've Said:
"Life's funny like that...elephants can wear frilly lace panties, and Dubya still looks like a monkey in a big chair"
"Take four goats and strap one to each foot of a llama. Presto, goat-powered llama!"
"You want to get me to work more, get me a Coke. No? Then deal with inferior garbage, I'm not coding another line and your clients can go to......thanks, I'd love a Coke right about now!"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|