How to return the number of CPUs in the system.
Posted on January 4, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 'System & API - How to return the number of CPUs in the system. 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 Public Function NumCPU() As Integer Dim lpSystemInfo As SYSTEM_INFO GetSystemInfo lpSystemInfo NumCPU = lpSystemInfo.dwNumberOrfProcessors End Function |