首页 /编程语言和算法/VB6/VBA/ASP
 VB6 测定系统的cpu类型,和机器里cpu的个数
2023年5月6日 19:10

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

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 Command1_Click()
    Dim InfoResult As SYSTEM_INFO
    GetSystemInfo InfoResult
    MsgBox "Your CPU type is " & InfoResult.dwProcessorType
    MsgBox "You have " & InfoResult.dwNumberOrfProcessors & " processor(s)"
End Sub


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