'http://www.vbbego.cjb.net
'Penulis: Shady - BEGO - 7/21/2004
Private Const PROCESSOR_INTEL_386 As Long = 386
Private Const PROCESSOR_INTEL_486 As Long = 486
Private Const PROCESSOR_INTEL_PENTIUM As Long = 586
Private Const PROCESSOR_MIPS_R4000 As Long = 4000
Private Const PROCESSOR_ALPHA_21064 As Long = 21064
Private Const PROCESSOR_PPC_601 As Long = 601
Private Const PROCESSOR_PPC_603 As Long = 603
Private Const PROCESSOR_PPC_604 As Long = 604
Private Const PROCESSOR_PPC_620 As Long = 620
Private Const PROCESSOR_HITACHI_SH3 As Long = 10003 'Windows CE
Private Const PROCESSOR_HITACHI_SH3E As Long = 10004 'Windows CE
Private Const PROCESSOR_HITACHI_SH4 As Long = 10005 'Windows CE
Private Const PROCESSOR_MOTOROLA_821 As Long = 821 'Windows CE
Private Const PROCESSOR_SHx_SH3 As Long = 103 'Windows CE
Private Const PROCESSOR_SHx_SH4 As Long = 104 'Windows CE
Private Const PROCESSOR_STRONGARM As Long = 2577 'Windows CE - 0xA11
Private Const PROCESSOR_ARM720 As Long = 1824 'Windows CE - 0x720
Private Const PROCESSOR_ARM820 As Long = 2080 'Windows CE - 0x820
Private Const PROCESSOR_ARM920 As Long = 2336 'Windows CE - 0x920
Private Const PROCESSOR_ARM_7TDMI As Long = 70001 'Windows CE
Private Const PROCESSOR_ARCHITECTURE_INTEL As Long = 0
Private Const PROCESSOR_ARCHITECTURE_MIPS As Long = 1
Private Const PROCESSOR_ARCHITECTURE_ALPHA As Long = 2
Private Const PROCESSOR_ARCHITECTURE_PPC As Long = 3
Private Const PROCESSOR_ARCHITECTURE_SHX As Long = 4
Private Const PROCESSOR_ARCHITECTURE_ARM As Long = 5
Private Const PROCESSOR_ARCHITECTURE_IA64 As Long = 6
Private Const PROCESSOR_ARCHITECTURE_ALPHA64 As Long = 7
Private Const PROCESSOR_ARCHITECTURE_UNKNOWN As Long = &HFFFF&
Private Const PROCESSOR_LEVEL_80386 As Long = 3
Private Const PROCESSOR_LEVEL_80486 As Long = 4
Private Const PROCESSOR_LEVEL_PENTIUM As Long = 5
Private Const PROCESSOR_LEVEL_PENTIUMII As Long = 6
Private Const sCPURegKey = "HARDWARE\DESCRIPTION\System\CentralProcessor\0"
Private Const HKEY_LOCAL_MACHINE As Long = &H80000002
Private Type SYSTEM_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
wProcessorLevel As Integer
wProcessorRevision As Integer
End Type
Private Declare Sub GetSystemInfo Lib "kernel32" _
(lpSystemInfo As SYSTEM_INFO)
Private Declare Function RegCloseKey Lib "advapi32" _
(ByVal hKey As Long) As Long
Private Declare Function RegOpenKey Lib "advapi32" _
Alias "RegOpenKeyA" _
(ByVal hKey As Long, _
ByVal lpSubKey As String, _
phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32" _
Alias "RegQueryValueExA" _
(ByVal hKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
lpType As Long, _
lpData As Any, _
lpcbData As Long) As Long
Private Sub Command1_Click()
Dim SI As SYSTEM_INFO
Dim tmp As String
Call GetSystemInfo(SI)
Print "Number Of Processors", SI.dwNumberOfProcessors
Select Case SI.dwProcessorType
Case PROCESSOR_INTEL_386: tmp = "386"
Case PROCESSOR_INTEL_486: tmp = "486"
Case PROCESSOR_INTEL_PENTIUM: tmp = "Pentium"
Case PROCESSOR_MIPS_R4000: tmp = "MIPS 4000"
Case PROCESSOR_ALPHA_21064: tmp = "Alpha"
End Select
Print "Processor Type", SI.dwProcessorType, tmp
Select Case SI.wProcessorLevel
Case PROCESSOR_LEVEL_80386: tmp = "Intel 80386"
Case PROCESSOR_LEVEL_80486: tmp = "Intel 80486"
Case PROCESSOR_LEVEL_PENTIUM: tmp = "Intel Pentium"
Case PROCESSOR_LEVEL_PENTIUMII: tmp = "Intel Pentium Pro, II, III or 4"
End Select
Print "Processor Level", SI.wProcessorLevel, tmp
Print "Processor Revision", SI.wProcessorRevision, _
"Model "; HiByte(SI.wProcessorRevision) & _
", Stepping " & LoByte(SI.wProcessorRevision)
Print "CPU Speed", , " " & GetCPUSpeed() & " MHz"
End Sub
Private Function GetCPUSpeed() As Long
Dim hKey As Long
Dim cpuSpeed As Long
Call RegOpenKey(HKEY_LOCAL_MACHINE, sCPURegKey, hKey)
Call RegQueryValueEx(hKey, "~MHz", 0, 0, cpuSpeed, 4)
Call RegCloseKey(hKey)
GetCPUSpeed = cpuSpeed
End Function
Public Function HiByte(ByVal wParam As Integer) As Byte
HiByte = (wParam And &HFF00&) \ (&H100)
End Function
Public Function LoByte(ByVal wParam As Integer) As Byte
LoByte = wParam And &HFF&
End Function
No comments:
Post a Comment