首页 /编程语言和算法/VB6/ASP
 VB6 得到当前系统的处理器个数
今天 17:43

新建From1(窗体),新建Command1(按钮CommandButton),代码:

Option Explicit
Private Type CPU_Type
    a As Long
    b As Long
    c As Long
    d As Long
    Processormask As Long
    Number_of_Processors As Long
    ProcessorType As Long
    e As Long
    f As Long
End Type
Private Declare Sub GetSystemInfo Lib "kernel32" (CPUinfo As CPU_Type)

Private Sub Command1_Click()
    Dim CPU As CPU_Type
    GetSystemInfo CPU
    Debug.Print "CPU类型为:"; CPU.ProcessorType '可能不准显示586
    Debug.Print "CPU个数:"; CPU.Number_of_Processors
End Sub

运行结果:

CPU类型为: 586 
CPU个数: 4


 
全部回复(0)
首页 | 电脑版 |