NumberOfCPUs – The number of processors

Const HKEY_LOCAL_MACHINE = &H80000002' Return the number of processors'' Requires the CheckRegistryKey routineFunction GetNumberOfCPUs() As Integer    Dim keyName As String    ' loop on the subkeys of HKEY_LOCAL_MACHINEHardwareDescriptionSystem    ' CentralProcessor    ' subkeys are zero-based    Do        GetNumberOfCPUs = GetNumberOfCPUs + 1        keyName = "HardwareDescriptionSystemCentralProcessor" & CStr _            (GetNumberOfCPUs)        ' if this key doesn't exist, then GetNumberOfCPUs        ' contains the number of keys found so far    Loop While CheckRegistryKey(HKEY_LOCAL_MACHINE, keyName)    End Function

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: