Code:
Option Explicit
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
        dwNumberOfProcessors As Long
        dwProcessorType As Long
        dwAllocationGranularity As Long
        dwReserved As Long
End Type
Public Enum etProcessorType
    PROCESSOR_INTEL_386 = 386
    PROCESSOR_INTEL_486 = 486
    PROCESSOR_INTEL_PENTIUM = 586
    PROCESSOR_MIPS_R4000 = 4000
    PROCESSOR_ALPHA_21064 = 21064
End Enum
Private m_typSystemInfo As SYSTEM_INFO

Public Function NumberOfProcessors() As Long
    GetSystemInfo m_typSystemInfo
    NumberOfProcessors = m_typSystemInfo.dwNumberOfProcessors
End Function