![]() |
Tipp 0293
|
Anzahl der Prozessoren ermitteln
|
 |
|
Autor/Einsender: Datum: |
|
Julien Gedeon 09.12.2002 |
|
Entwicklungsumgebung: |
|
VB 5 |
|
|
Windows NT, 2000 und XP können mehrere Prozessoren nutzen. Dieser Tipp zeigt, wie man mit
der API-Funktion GetSystemInfo aus dem Kernel die Anzahl der Prozessoren
ermitteln kann. Diese API-Funktion kann noch mehr, wie die recht üppige Typendeklaration
vermuten lässt, aber wir beschränken uns hier auf das Auslesen der Prozessoren.
|
|
|
Option Explicit
Private Declare Sub GetSystemInfo Lib "kernel32" ( _
lpSystemInfo As Systeminfo)
Private Type Systeminfo
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 Sub GetNumberOfProcessors()
Dim sysInfo As Systeminfo
GetSystemInfo sysInfo
MsgBox "Anzahl der Prozessoren: " & sysInfo.dwNumberOfProcessors
End Sub
|
|
|
|
Der hier abgebildete Code funktioniert auch in einem VBA-Projekt, dieser muss dazu
lediglich in den VB-Editor der entsprechenden Anwendung kopiert werden. Ein Import
der im Download enthaltenen *.frm-Datei ist nicht möglich.
|
|
Windows-Version |
95 |
 |
|
98/SE |
 |
|
ME |
 |
|
NT |
 |
|
2000 |
 |
|
XP |
 |
|
Vista |
 |
|
Win
7 |
 |
|
|
VB-Version |
VBA 5 |
 |
|
VBA 6 |
 |
|
VB 4/16 |
 |
|
VB 4/32 |
 |
|
VB 5 |
 |
|
VB 6 |
 |
|
|
|
Download (2,7 kB)
|
Downloads bisher: [ 1267 ]
|
|
|