API使用如下:
宣告,於模組宣告,並宣告相關結構
Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO)
Type SYSTEM_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOrfProcessors As Long
dwProcessorType As Long
dwProcessLevel As Integer
dwAllocationGranularity As Integer
dwReserved As Long
End Type
用法 ●得知CPU種類
Dim CPUInfo As SYSTEM_INFO
GetSystemInfo CPUInfo
Select Case CPUInfo.ProcessType
Case 386
Print "這是386的CPU"
Case 486
Print "這是486的CPU"
Case 586
Print "這是586的CPU"
Case 4000
Print "這是MIPS 4000的CPU"
Case 21064
Print "這是Alpha的CPU"
End Select
●得知CPU有幾顆
Dim CPUInfo As SYSTEM_INFO
GetSystemInfo CPUInfo
MsgBox "你的電腦上有" & CPUInfo.dwNumberOrfProcessors & "顆
CPU"
●得知CPU最大定址
Dim CPUInfo As SYSTEM_INFO
GetSystemInfo CPUInfo
MsgBox "你的CPU最大定址" & CPUInfo.lpMaximumApplicationAddress
& "顆CPU"
●從Pentuim時代開始,有K5、Pentium MMX、6x86......等CPU加入戰局,因此用ProcessType的方式很難得知這是一顆怎樣的CPU,因此有了dwResved,得知修訂編號,以判斷這是那一顆CPU。
Dim CPUInfo As SYSTEM_INFO
GetSystemInfo CPUInfo
MsgBox "你的CPU修訂編號是" & CPUInfo.dwReserved
●小瓜瓜沒有辦法對每一顆CPU作測試,請求各位網友將你的CPU總類、廠牌及GetSystemInfo的各項結果登出來,以利網友們的查詢!
●以下是網友提供的數據
dwReserved CPU 提供
100794373 K6-166 李森遠
100990982 Celeron 366 Victor W.P. Tung
101318662 PII-366 Victor W.P. Tung
84017158 PII-400 Victor W.P. Tung
135004165 K6-2-350 Victor W.P. Tung