Rubrik: System/Windows · Sonstiges | VB-Versionen: VB4, VB5, VB6 | 04.06.04 |
Anzahl installierter Prozessoren ermitteln Dieser Tipp verrät, wie sich die Anzahl installierter Prozessoren ermitteln lässt. | ||
Autor: Dieter Otter | Bewertung: | Views: 15.952 |
www.tools4vb.de | System: Win9x, WinNT, Win2k, WinXP, Win7, Win8, Win10, Win11 | Beispielprojekt auf CD |
Windows 2000 und Windows XP unterstützten bekanntlich mehrere Prozessoren. Wie man die Anzahl der installierten Prozessoren ermitteln kann, zeigt nachfolgender Tipp.
Fügen Sie nachfolgenden Code am besten in ein Modul:
Option Explicit ' Benötigte API-Deklarationen 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
' Anzahl installierter Prozessoren ermitteln Public Function NumProcessors() As Integer Dim tSysInfo As SYSTEM_INFO ' SytemInfo ermitteln GetSystemInfo tSysInfo ' Anzahl Prozessoren zurückgeben NumProcessors = tSysInfo.dwNumberOrfProcessors End Function
Beispiel für den Aufruf:
Dim nProcessorCount As Integer nProcessorCount = NumProcessors() MsgBox CStr(nProcessorCount) & " Prozessor(en) installiert."