Füge einfach
[autoit]
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $width, $height) ;kopiere Backbuffer in die GUI
zwischen die Zeile 21 und 22 ein.
Gruß,
UEZ
Füge einfach
[autoit]
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $width, $height) ;kopiere Backbuffer in die GUI
zwischen die Zeile 21 und 22 ein.
Gruß,
UEZ
Hier ein simples Beispiel zur Halbzeitpause
Gruß,
UEZ
Oder so:
[autoit]
$search = "]connectionproblem"
$logfile = "ap.txt" ;Pfad zur Logdatei
$file = FileOpen($logfile, 0)
$i = 1
While 1
$line = FileReadLine($file)
If @error = -1 Then ExitLoop
If StringInStr($line, $search) > 0 Then ConsoleWrite("Gefunden in Zeile: " & $i & @CRLF)
$i += 1
WEnd
FileClose($file)
Gruß,
UEZ
Hier meine Version, um "Icons" (eigentlich Bitmaps) in GUI Menüs darzustellen.
UDF:
;~ #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include-once
#include <GDIPlus.au3>
#include <WinAPIShellEx.au3>
#include <WinAPISysWin.au3>
#include <WindowsConstants.au3>
_GDIPlus_Startup()
OnAutoItExitRegister("_Exit_GUICtrlMenu_CreateBitmap")
; #FUNCTION# ============================================================================================================
; Name...................: _GUICtrlMenu_CreateBitmap
; Description .......: Extracts the icon from $sFile and converts it to a HBitmap format
; Syntax................: _GUICtrlMenu_CreateBitmap($sFile, $iIndex = 0, $iX = 16, $iY = 16)
; Parameters ......: $sFile - file name where the icon should be extracted from or an image should be loaded (*.dll, *.ico, *.exe, *.jpg, *.png, *.bmp, *.gif, *.tif)
; $iIndex - index of the icon from $sFile
; $iW - set the width of the extracted icon
; $iH - set the height of the extracted icon
; $iBgColor - set background color from _WinAPI_GetSysColor($COLOR_MENU) if $iBgColor = -1
; Return values .: Success - handle to a HBITMAP
; Failure - Returns 0 and sets error to 1-7
; Author ..............: UEZ
; Version .............: v0.71 Build 2018-08-17 beta
; Remarks ...........: Don't forget to use _WinAPI_DeleteObject($<handle to the HBITMAP>) when closing to to release the resources
; =======================================================================================================================
Func _GUICtrlMenu_CreateBitmap($sFile, $iIndex = 0, $iW = 16, $iH = 16, $iBgColor = -1)
Local $hIcon, $Ret, $hBitmap, $hContext, $bBinary = False
Local $aChk = _GDIPlus_ImageGetFlags($sFile)
If Not @error Then $bBinary = True
If FileExists($sFile) Or $bBinary Then
Local $sExt = StringMid($sFile, StringLen($sFile) - 3)
If $bBinary Then $sExt = "0815"
Switch $sExt
Case ".dll", ".exe", ".ico"
Return _WinAPI_GetFileIcon($sFile, $iIndex, $iW, $iH, $iBgColor)
Case ".jpg", ".png", ".bmp", ".gif", ".tif", "0815"
Local $hImage
If Not $bBinary Then
$hImage = _GDIPlus_ImageLoadFromFile($sFile)
If @error Then Return SetError(4, @extended, 0)
Else
$hImage = $sFile
EndIf
$hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
If @error Then Return SetError(5, @extended, 0)
$hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetInterpolationMode($hContext, $GDIP_INTERPOLATIONMODE_HIGHQUALITY)
_GDIPlus_GraphicsDrawImageRect($hContext, $hImage, 0, 0, $iW, $iH)
$hIcon = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap)
_GDIPlus_GraphicsDispose($hContext)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_BitmapDispose($hImage)
If Not $hIcon Then Return SetError(6, 0, 0)
Case Else
Return SetError(7, 0, 0)
EndSwitch
Return $hIcon
Else
Return SetError(1, 0, 0)
EndIf
EndFunc ;==>_GUICtrlMenu_CreateBitmap
Func _WinAPI_GetFileIcon($sFile, $iIndex, $iW, $iH, $iColor)
Local $aRet, $hIcon, $hHBitmap
Local $hDC, $hBackDC, $hBackSv
$hIcon = _WinAPI_ShellExtractIcon($sFile, $iIndex, $iW, $iH)
If @error Then Return SetError(6, @extended, 0)
$hDC = _WinAPI_GetDC(0)
$hBackDC = _WinAPI_CreateCompatibleDC($hDC)
If $iColor = -1 Then $iColor = _WinAPI_GetSysColor($COLOR_MENU)
$hHBitmap = _WinAPI_CreateSolidBitmap(0, $iColor, $iW, $iH)
$hBackSv = _WinAPI_SelectObject($hBackDC, $hHBitmap)
_WinAPI_DrawIconEx($hBackDC, 0, 0, $hIcon, $iW, $iH)
_WinAPI_DestroyIcon($hIcon)
_WinAPI_SelectObject($hBackDC, $hBackSv)
_WinAPI_ReleaseDC(0, $hDC)
_WinAPI_DeleteDC($hBackDC)
Return $hHBitmap
EndFunc ;==>_GUICtrlMenu_CreateBitmap
Func _Exit_GUICtrlMenu_CreateBitmap()
_GDIPlus_Shutdown()
EndFunc
Alles anzeigen
Beispiel1:
#include <GDIPlus.au3>
#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <_GUICtrlMenu_CreateBitmap.au3>
Opt('MustDeclareVars', 1)
Global $iMemo
_Main()
Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout
#region
; Create GUI
$hGUI = GUICreate("Menu", 400, 300)
; Create File menu
$hFile = _GUICtrlMenu_CreateMenu()
_GUICtrlMenu_InsertMenuItem($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem($hFile, 4, "E&xit", $idExit)
; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu()
_GUICtrlMenu_InsertMenuItem($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem($hEdit, 2, "&Paste", $idPaste)
; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu()
_GUICtrlMenu_InsertMenuItem($hHelp, 0, "&About", $idAbout)
; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu()
_GUICtrlMenu_InsertMenuItem($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem($hMain, 2, "&Help", 0, $hHelp)
; Set window menu
_GUICtrlMenu_SetMenu($hGUI, $hMain)
; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 276, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
#endregion
Local $hBMP_File_New = _GUICtrlMenu_CreateBitmap(StringReplace(@AutoItExe, "autoit3.exe", "Examples\GUI\Torus.png"), 0, 32, 32)
; Set New menu item to have a bitmap
_GUICtrlMenu_SetItemBmp($hFile, 0, $hBMP_File_New)
MemoWrite("Item bitmap handle: 0x" & Hex(_GUICtrlMenu_GetItemBmp($hFile, 0)))
Local $hBMP_File_Open = _GUICtrlMenu_CreateBitmap(@SystemDir & "\Shell32.dll", 4, 32, 32)
; Set New menu item to have a bitmap
_GUICtrlMenu_SetItemBmp($hFile, 1, $hBMP_File_Open)
MemoWrite("Item bitmap handle: 0x" & Hex(_GUICtrlMenu_GetItemBmp($hFile, 1)))
Local $hBMP_File_Save = _GUICtrlMenu_CreateBitmap(@SystemDir & "\Shell32.dll", 6, 32, 32)
; Set New menu item to have a bitmap
_GUICtrlMenu_SetItemBmp($hFile, 2, $hBMP_File_Save)
MemoWrite("Item bitmap handle: 0x" & Hex(_GUICtrlMenu_GetItemBmp($hFile, 2)))
Local $hBMP_File_Quit = _GUICtrlMenu_CreateBitmap(@SystemDir & "\Shell32.dll", 27, 32, 32)
; Set New menu item to have a bitmap
_GUICtrlMenu_SetItemBmp($hFile, 4, $hBMP_File_Quit)
MemoWrite("Item bitmap handle: 0x" & Hex(_GUICtrlMenu_GetItemBmp($hFile, 4)))
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
_WinAPI_DeleteObject($hBMP_File_New)
_WinAPI_DeleteObject($hBMP_File_Open)
_WinAPI_DeleteObject($hBMP_File_Save)
_WinAPI_DeleteObject($hBMP_File_Quit)
EndFunc ;==>_Main
; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
Alles anzeigen
Gruß,
UEZ
Schaue mal unter http://translation.autoit.de/onlinehilfe/functions/RunWait.htm nach show_flag.
Das sollte dir helfen!
Wenn nicht, einfach wieder melden.
Gruß,
UEZ
Das ist das Verhältnis der Phasenlage von links und rechts.
Vielleicht ist dir schon mal aufgefallen, daß eine Stereoanlage "komisch" klingt, wenn man bei einer Box die Kabel falsch angesteckt hat.
Dann bewegt sich nämlich die Membran falsch - nämlich rein, wenn sie sich raus bewegen soll und umgekehrt.Setz dir mal Kopfhörer auf (dann hört man den Effekt am besten), starte das Script mit dieser Musikdatei und beobachte die Anzeige:
Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.
Ok, jetzt habe ich es verstanden!
Danke,
UEZ
Meisterliche GDI+ Leistung (wie immer)!
Ich finde es schöner, wenn man noch _GDIPlus_GraphicsFillPolygon($hGfxBuffer, $aPhase, $hBrushPhase) in die Funktion _Phase() einbaut, ist aber geschmacksache! ![]()
Was zeigt uns denn der der untere horizontale Meter ( Korrelationsgradmesser?) an?
Gruß,
UEZ
Kein Problem:
Test Plattform 1:
OS: Windows 2003 R2 Std. SP2 x32
==========================================
Computer: Test Plattform 1
==========================================
AddressWidth: 32
Architecture: 0
Availability: 3
Caption: x86 Family 6 Model 23 Stepping 6
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 1
CreationClassName: Win32_Processor
CurrentClockSpeed: 2666
CurrentVoltage: 14
DataWidth: 32
Description: x86 Family 6 Model 23 Stepping 6
DeviceID: CPU0
ErrorCleared:
ErrorDescription:
ExtClock: 1333
Family: 176
L2CacheSize: 12288
L2CacheSpeed: 2666
LastErrorCode:
Level: 6
LoadPercentage: 0
Manufacturer: GenuineIntel
MaxClockSpeed: 2666
Name: Intel(R) Pentium(R) III Xeon processor
OtherFamilyDescription:
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: False
ProcessorId: BFEBFBFF00010676
ProcessorType: 3
Revision: 5894
Role: CPU
SocketDesignation: Proc 1
Status: OK
StatusInfo: 3
Stepping: 6
SystemCreationClassName: Win32_ComputerSystem
SystemName: Test Plattform 1
UniqueId:
UpgradeMethod: 9
Version: Model 7, Stepping 6
VoltageCaps:
AddressWidth: 32
Architecture: 0
Availability: 3
Caption: x86 Family 6 Model 23 Stepping 6
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 0
CreationClassName: Win32_Processor
CurrentClockSpeed: 2666
CurrentVoltage: 14
DataWidth: 32
Description: x86 Family 6 Model 23 Stepping 6
DeviceID: CPU1
ErrorCleared:
ErrorDescription:
ExtClock: 200
Family: 17
L2CacheSize: 0
L2CacheSpeed: 2666
LastErrorCode:
Level: 6
LoadPercentage: 0
Manufacturer: GenuineIntel
MaxClockSpeed: 2666
Name: Intel(R) Pentium(R) III processor
OtherFamilyDescription:
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: False
ProcessorId: 0000000000000000
ProcessorType: 3
Revision: 5894
Role: CPU
SocketDesignation: Proc 2
Status: OK
StatusInfo: 3
Stepping: 6
SystemCreationClassName: Win32_ComputerSystem
SystemName: Test Plattform 1
UniqueId:
UpgradeMethod: 20
Version: Model 7, Stepping 6
VoltageCaps:
AddressWidth: 32
Architecture: 0
Availability: 3
Caption: x86 Family 6 Model 23 Stepping 6
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 1
CreationClassName: Win32_Processor
CurrentClockSpeed: 2666
CurrentVoltage: 14
DataWidth: 32
Description: x86 Family 6 Model 23 Stepping 6
DeviceID: CPU2
ErrorCleared:
ErrorDescription:
ExtClock: 1333
Family: 176
L2CacheSize: 12288
L2CacheSpeed: 2666
LastErrorCode:
Level: 6
LoadPercentage: 0
Manufacturer: GenuineIntel
MaxClockSpeed: 2666
Name: Intel(R) Pentium(R) III Xeon processor
OtherFamilyDescription:
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: False
ProcessorId: BFEBFBFF00010676
ProcessorType: 3
Revision: 5894
Role: CPU
SocketDesignation: Proc 1
Status: OK
StatusInfo: 3
Stepping: 6
SystemCreationClassName: Win32_ComputerSystem
SystemName: Test Plattform 1
UniqueId:
UpgradeMethod: 9
Version: Model 7, Stepping 6
VoltageCaps:
AddressWidth: 32
Architecture: 0
Availability: 3
Caption: x86 Family 6 Model 23 Stepping 6
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 1
CreationClassName: Win32_Processor
CurrentClockSpeed: 2666
CurrentVoltage: 14
DataWidth: 32
Description: x86 Family 6 Model 23 Stepping 6
DeviceID: CPU3
ErrorCleared:
ErrorDescription:
ExtClock: 1333
Family: 176
L2CacheSize: 12288
L2CacheSpeed: 2666
LastErrorCode:
Level: 6
LoadPercentage: 0
Manufacturer: GenuineIntel
MaxClockSpeed: 2666
Name: Intel(R) Pentium(R) III Xeon processor
OtherFamilyDescription:
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: False
ProcessorId: BFEBFBFF00010676
ProcessorType: 3
Revision: 5894
Role: CPU
SocketDesignation: Proc 1
Status: OK
StatusInfo: 3
Stepping: 6
SystemCreationClassName: Win32_ComputerSystem
SystemName: Test Plattform 1
UniqueId:
UpgradeMethod: 9
Version: Model 7, Stepping 6
VoltageCaps:
Test Plattform 2:
OS: Windows 2003 Ent. SP2 x64
==========================================
Computer: Test Plattform 2
==========================================
AddressWidth: 64
Architecture: 9
Availability: 3
Caption: EM64T Family 6 Model 29 Stepping 1
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 1
CreationClassName: Win32_Processor
CurrentClockSpeed: 2400
CurrentVoltage: 12
DataWidth: 64
Description: EM64T Family 6 Model 29 Stepping 1
DeviceID: CPU0
ErrorCleared:
ErrorDescription:
ExtClock: 1066
Family: 2
L2CacheSize: 6144
L2CacheSpeed:
LastErrorCode:
Level: 6
LoadPercentage: 0
Manufacturer: GenuineIntel
MaxClockSpeed: 2400
Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
OtherFamilyDescription:
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: False
ProcessorId: BFEBFBFF000106D1
ProcessorType: 3
Revision: 7425
Role: CPU
SocketDesignation: Proc 1
Status: OK
StatusInfo: 3
Stepping: 1
SystemCreationClassName: Win32_ComputerSystem
SystemName: Test Plattform 2
UniqueId:
UpgradeMethod: 4
Version: Model 13, Stepping 1
VoltageCaps:
AddressWidth: 64
Architecture: 9
Availability: 3
Caption: EM64T Family 6 Model 29 Stepping 1
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 4
CreationClassName: Win32_Processor
CurrentClockSpeed: 2400
CurrentVoltage: 12
DataWidth: 64
Description: EM64T Family 6 Model 29 Stepping 1
DeviceID: CPU1
ErrorCleared:
ErrorDescription:
ExtClock: 1066
Family: 2
L2CacheSize: 6144
L2CacheSpeed:
LastErrorCode:
Level: 6
LoadPercentage: 0
Manufacturer: GenuineIntel
MaxClockSpeed: 2400
Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
OtherFamilyDescription:
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: False
ProcessorId: BFEBFBFF000106D1
ProcessorType: 3
Revision: 7425
Role: CPU
SocketDesignation: Proc 2
Status: OK
StatusInfo: 3
Stepping: 1
SystemCreationClassName: Win32_ComputerSystem
SystemName: Test Plattform 2
UniqueId:
UpgradeMethod: 4
Version: Model 13, Stepping 1
VoltageCaps:
AddressWidth: 64
Architecture: 9
Availability: 3
Caption: EM64T Family 6 Model 29 Stepping 1
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 0
CreationClassName: Win32_Processor
CurrentClockSpeed: 2400
CurrentVoltage: 12
DataWidth: 64
Description: EM64T Family 6 Model 29 Stepping 1
DeviceID: CPU2
ErrorCleared:
ErrorDescription:
ExtClock: 200
Family: 2
L2CacheSize: 0
L2CacheSpeed:
LastErrorCode:
Level: 6
LoadPercentage: 0
Manufacturer: GenuineIntel
MaxClockSpeed: 2400
Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
OtherFamilyDescription:
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: False
ProcessorId: 0000000000000000
ProcessorType: 3
Revision: 7425
Role: CPU
SocketDesignation: Proc 3
Status: OK
StatusInfo: 3
Stepping: 1
SystemCreationClassName: Win32_ComputerSystem
SystemName: Test Plattform 2
UniqueId:
UpgradeMethod: 4
Version: Model 13, Stepping 1
VoltageCaps:
AddressWidth: 64
Architecture: 9
Availability: 3
Caption: EM64T Family 6 Model 29 Stepping 1
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 0
CreationClassName: Win32_Processor
CurrentClockSpeed: 2400
CurrentVoltage: 12
DataWidth: 64
Description: EM64T Family 6 Model 29 Stepping 1
DeviceID: CPU3
ErrorCleared:
ErrorDescription:
ExtClock: 200
Family: 2
L2CacheSize: 0
L2CacheSpeed:
LastErrorCode:
Level: 6
LoadPercentage: 2
Manufacturer: GenuineIntel
MaxClockSpeed: 2400
Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
OtherFamilyDescription:
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: False
ProcessorId: 0000000000000000
ProcessorType: 3
Revision: 7425
Role: CPU
SocketDesignation: Proc 4
Status: OK
StatusInfo: 3
Stepping: 1
SystemCreationClassName: Win32_ComputerSystem
SystemName: Test Plattform 2
UniqueId:
UpgradeMethod: 4
Version: Model 13, Stepping 1
VoltageCaps:
AddressWidth: 64
Architecture: 9
Availability: 3
Caption: EM64T Family 6 Model 29 Stepping 1
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 1
CreationClassName: Win32_Processor
CurrentClockSpeed: 2400
CurrentVoltage: 12
DataWidth: 64
Description: EM64T Family 6 Model 29 Stepping 1
DeviceID: CPU4
ErrorCleared:
ErrorDescription:
ExtClock: 1066
Family: 2
L2CacheSize: 6144
L2CacheSpeed:
LastErrorCode:
Level: 6
LoadPercentage: 0
Manufacturer: GenuineIntel
MaxClockSpeed: 2400
Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
OtherFamilyDescription:
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: False
ProcessorId: BFEBFBFF000106D1
ProcessorType: 3
Revision: 7425
Role: CPU
SocketDesignation: Proc 1
Status: OK
StatusInfo: 3
Stepping: 1
SystemCreationClassName: Win32_ComputerSystem
SystemName: Test Plattform 2
UniqueId:
UpgradeMethod: 4
Version: Model 13, Stepping 1
VoltageCaps:
AddressWidth: 64
Architecture: 9
Availability: 3
Caption: EM64T Family 6 Model 29 Stepping 1
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 1
CreationClassName: Win32_Processor
CurrentClockSpeed: 2400
CurrentVoltage: 12
DataWidth: 64
Description: EM64T Family 6 Model 29 Stepping 1
DeviceID: CPU5
ErrorCleared:
ErrorDescription:
ExtClock: 1066
Family: 2
L2CacheSize: 6144
L2CacheSpeed:
LastErrorCode:
Level: 6
LoadPercentage: 0
Manufacturer: GenuineIntel
MaxClockSpeed: 2400
Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
OtherFamilyDescription:
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: False
ProcessorId: BFEBFBFF000106D1
ProcessorType: 3
Revision: 7425
Role: CPU
SocketDesignation: Proc 1
Status: OK
StatusInfo: 3
Stepping: 1
SystemCreationClassName: Win32_ComputerSystem
SystemName: Test Plattform 2
UniqueId:
UpgradeMethod: 4
Version: Model 13, Stepping 1
VoltageCaps:
AddressWidth: 64
Architecture: 9
Availability: 3
Caption: EM64T Family 6 Model 29 Stepping 1
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 1
CreationClassName: Win32_Processor
CurrentClockSpeed: 2400
CurrentVoltage: 12
DataWidth: 64
Description: EM64T Family 6 Model 29 Stepping 1
DeviceID: CPU6
ErrorCleared:
ErrorDescription:
ExtClock: 1066
Family: 2
L2CacheSize: 6144
L2CacheSpeed:
LastErrorCode:
Level: 6
LoadPercentage: 0
Manufacturer: GenuineIntel
MaxClockSpeed: 2400
Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
OtherFamilyDescription:
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: False
ProcessorId: BFEBFBFF000106D1
ProcessorType: 3
Revision: 7425
Role: CPU
SocketDesignation: Proc 1
Status: OK
StatusInfo: 3
Stepping: 1
SystemCreationClassName: Win32_ComputerSystem
SystemName: Test Plattform 2
UniqueId:
UpgradeMethod: 4
Version: Model 13, Stepping 1
VoltageCaps:
AddressWidth: 64
Architecture: 9
Availability: 3
Caption: EM64T Family 6 Model 29 Stepping 1
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 1
CreationClassName: Win32_Processor
CurrentClockSpeed: 2400
CurrentVoltage: 12
DataWidth: 64
Description: EM64T Family 6 Model 29 Stepping 1
DeviceID: CPU7
ErrorCleared:
ErrorDescription:
ExtClock: 1066
Family: 2
L2CacheSize: 6144
L2CacheSpeed:
LastErrorCode:
Level: 6
LoadPercentage: 0
Manufacturer: GenuineIntel
MaxClockSpeed: 2400
Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
OtherFamilyDescription:
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: False
ProcessorId: BFEBFBFF000106D1
ProcessorType: 3
Revision: 7425
Role: CPU
SocketDesignation: Proc 1
Status: OK
StatusInfo: 3
Stepping: 1
SystemCreationClassName: Win32_ComputerSystem
SystemName: Test Plattform 2
UniqueId:
UpgradeMethod: 4
Version: Model 13, Stepping 1
VoltageCaps:
Gruß,
UEZ
Ich kann den Fehler auch nicht auf meinem Vista x32 sehen!
Der Code sieht auch nicht falsch aus!
Komisch...
Gruß,
UEZ
Welche Parameter hast du denn konkret benutzt?
Gruß,
UEZ
Alles anzeigenHmm
Ich bin ja kein Prof. aber ich denke mal das würde funktionieren:
[autoit]
Was passiert wenn man die Anzahl der CPUs die zurückgegeben werden mal durch vier teilt?[/autoit]
$ergebnis=$ergebnis/4
Also vieleicht nicht die beste Lösung (vieleicht sogar die falsche aber denke mal das das so richtig ist...
Edit: Bei mir
Anzahl CPUs: 1
Anzahl der Kerne: 2
Na ok ich denke ich habe keine 1/4 CPUs.
Ich habe Win7 32BitIch denke es liegt daran das deiner eine neue Technologie hat. Dann teilt man durch 4 sonst nicht.
Das Problem ist, dass z.B. das MB 2 Socket hat, aber nur eine CPU installiert ist. Wenn das Ergebnis 4 ist, weiß ich nicht, ob 1x Quad Core oder 2x Dual Core CPUs eingebaut ist bzw. sind!
Wenn man dies irgendwie unterscheiden könnte, könnte man die CPU errechnen.
Gruß,
UEZ
Was du unter Win32_PerfRawData_PerfOS_Processor ausliest, bekommst du auch unter Win32_ComputerSystemProcessor oder Win32_ComputerSystem (NumberOfProcessors) herraus.
Gruß,
UEZ
Alles anzeigenHm also unter Windows 7 wird es bei mir korrekt dargestellt (ohne Hyperthreading)
Spoiler anzeigen
[autoit][/autoit] [autoit][/autoit] [autoit]
#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****Local Const $wbemFlagReturnImmediately = 0x10
[/autoit] [autoit][/autoit] [autoit]
Local Const $wbemFlagForwardOnly = 0x20MsgBox(64, "Prozessor", "Anzahl CPUs: " & _GetCPUCount() & @CRLF & "Anzahl der Kerne: " & _GetCoreCount())
[/autoit] [autoit][/autoit] [autoit]Func _GetCoreCount(Const $Computer = "127.0.0.1")
[/autoit] [autoit][/autoit] [autoit]
$WMIConnect = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $Computer & '\root\CIMV2')
If Not IsObj($WMIConnect) Then Return SetError(-1, @error, 0)
$ObjList = $WMIConnect.ExecQuery('SELECT Name FROM Win32_PerfRawData_PerfOS_Processor', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If Not IsObj($ObjList) Then Return SetError(-2, @error, 0)
$iReturn = 0
For $ObjItem In $ObjList
If StringInStr($ObjItem.Name, "_Total") = 0 Then $iReturn += 1
Next
Return $iReturn
EndFunc ;==>_GetCoreCountFunc _GetCPUCount(Const $Computer = "127.0.0.1")
[/autoit]
$WMIConnect = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $Computer & '\root\CIMV2')
If Not IsObj($WMIConnect) Then Return SetError(-1, @error, 0)
$ObjList = $WMIConnect.ExecQuery('SELECT Name FROM Win32_Processor', 'WQL', $wbemFlagReturnImmediately)
If Not IsObj($ObjList) Then Return SetError(-2, @error, 0)
Return $ObjList.Count
EndFunc ;==>_GetCPUCount[Blockierte Grafik: http://img819.imageshack.us/img819/1443/cpucount.png]
Es ist ja scheinbar so, dass HT nur Einfluss auf die CPU Anzahl hat, die Anzahl der Cores stimmt ja bei dir soweit.
EDIT : Eventuell kann man es ja an der Device ID erkennen. Bin nicht in der Firma deshalb kann ichs leider nicht testen
Spoiler anzeigen
[autoit]#region ;**** Directives created by AutoIt3Wrapper_GUI ****
[/autoit] [autoit][/autoit] [autoit]
#AutoIt3Wrapper_UseX64=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****Local Const $wbemFlagReturnImmediately = 0x10
[/autoit] [autoit][/autoit] [autoit]
Local Const $wbemFlagForwardOnly = 0x20MsgBox(64, "Prozessor", "Anzahl CPUs: " & _GetCPUCount() & @CRLF & "Anzahl der Kerne: " & _GetCoreCount())
[/autoit] [autoit][/autoit] [autoit]Func _GetCoreCount(Const $Computer = "127.0.0.1")
[/autoit] [autoit][/autoit] [autoit]
$WMIConnect = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $Computer & '\root\CIMV2')
If Not IsObj($WMIConnect) Then Return SetError(-1, @error, 0)
$ObjList = $WMIConnect.ExecQuery('SELECT Name FROM Win32_PerfRawData_PerfOS_Processor', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If Not IsObj($ObjList) Then Return SetError(-2, @error, 0)
$iReturn = 0
For $ObjItem In $ObjList
If StringInStr($ObjItem.Name, "_Total") = 0 Then $iReturn += 1
Next
Return $iReturn
EndFunc ;==>_GetCoreCountFunc _GetCPUCount(Const $Computer = "127.0.0.1")
[/autoit]
$WMIConnect = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $Computer & '\root\CIMV2')
If Not IsObj($WMIConnect) Then Return SetError(-1, @error, 0)
$ObjList = $WMIConnect.ExecQuery('SELECT Name FROM Win32_Processor', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If Not IsObj($ObjList) Then Return SetError(-2, @error, 0)
$iReturn = 0
For $ObjItem In $ObjList
If $ObjItem.DeviceID = "CPU" & $iReturn Then $iReturn += 1
Next
Return $iReturn
EndFunc ;==>_GetCPUCount
Hier das Resultat deines Skriptes:
Test Plattform 1) -> Anzahl CPUs: 8 / Anzahl der Kerne: 8 -> sollte CPUs: 2 / Kerne: 8 sein
Test Plattform 2) -> Anzahl CPUs: 4 / Anzahl der Kerne: 4 -> sollte CPUs: 1 / Kerne: 4 sein
Gruß,
UEZ
Alles anzeigenSo ich glaub ich habe es (hoffentlich :D)
Spoiler anzeigen
[autoit]#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
[/autoit] [autoit][/autoit] [autoit]
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****Local Const $wbemFlagReturnImmediately = 0x10
[/autoit] [autoit][/autoit] [autoit]
Local Const $wbemFlagForwardOnly = 0x20MsgBox(64,"Prozessor","Anzahl der Kerne: " & _Processor())
[/autoit] [autoit][/autoit] [autoit]Func _Processor($Computer = "127.0.0.1")
[/autoit]
$WMIConnect = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $Computer & '\root\CIMV2')
If Not IsObj($WMIConnect) Then Return SetError(-1, @error, 0)
$ObjList = $WMIConnect.ExecQuery('SELECT Name FROM Win32_PerfRawData_PerfOS_Processor', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If Not IsObj($ObjList) Then Return SetError(-2, @error, 0)
$iReturn = 0
For $ObjItem In $ObjList
If StringInStr($ObjItem.Name,"_Total") = 0 Then $iReturn +=1
Next
Return $iReturn
EndFunc ;==>_ProcessorHabe es unter Win7 x64 (QuadCore) und unter XPSP3 (Dual Core) in ner VM getestet
Sicherlich hab ich dich falsch verstanden aber geht es nicht so?:
Spoiler anzeigen
[autoit]MsgBox(0,"Anzahl CPUs", _GetCPUCount())
[/autoit] [autoit][/autoit] [autoit]Func _GetCPUCount(Const $sPC = "localhost")
[/autoit]
Local $oWMI = ObjGet("winmgmts:\\" & $sPC & "\root\CIMV2")
Return $oWMI.ExecQuery("SELECT * FROM Win32_Processor", "WQL", 16).Count
EndFunc
Hier das Resultat beider Skripts:
Test Plattform
1) HP ProLiant DL580 G5 mit 2 x Intel(R) Xeon(TM) Processor MP 2.4 GHz (x64 Family 6 Model 13 Stepping 1) auf einem 4 CPU Sockel MB -> 8 logische CPUs
Mahagon: 8
AspirinJunkie: 8
2) ProLiant DL360 G5 mit 1 x Intel(R) Xeon(TM) Processor 2.666 GHz (x86 Family 6 Model 7 Stepping 6) auf einem 2 CPU Sockel MB -> 4 logische CPUs
Mahagon: 4
AspirinJunkie: 4
Beide CPUs sind 4 Core CPUs!
Jetzt muss ich mir nur noch überlegen, ob ich mit den Infos oben die Anzahl der CPUs errechnen kann, wobei ich HT noch berücksichtigen muss...
DANKE,
UEZ
Sicherlich hab ich dich falsch verstanden aber geht es nicht so?:
Spoiler anzeigen
[autoit]MsgBox(0,"Anzahl CPUs", _GetCPUCount())
[/autoit] [autoit][/autoit] [autoit]Func _GetCPUCount(Const $sPC = "localhost")
[/autoit]
Local $oWMI = ObjGet("winmgmts:\\" & $sPC & "\root\CIMV2")
Return $oWMI.ExecQuery("SELECT * FROM Win32_Processor", "WQL", 16).Count
EndFunc
Hmmm, sieht interessant aus! Muss ich morgen mal testen, da ich gerade keinen Server zur Verügung habe!
Ich hoffe nicht, dass Count die Anzahl der Sockets zurück gibt, was nicht gleich ist, mit der Belegung der Sockets!
Aber mal sehen...
Vielen Dank!
Gruß,
UEZ
Danke für deine Mühe, aber ich will nicht die Kerne, sondern die Anzahl der CPUs oder auch die belegten CPU Sockets mit einer CPU auf dem MB haben!
Das Problem ist, dass man Zuhause i.d.R. nur eine CPU hat! Aber in der Serverwelt sieht das schon anders aus...
Das MB eines Servers kann z.B. 4 Sockets haben, aber 2 sind nur belegt!
Gruß,
UEZ
Damit kann man keine Remote Systeme abfragen ![]()
Gruß,
UEZ
Herzlichen Glückwunsch und alles Gute!
Gruß,
UEZ
Das hilft leider auch nicht, da Duo oder Quad nicht immer im Namen vorkommt! Ferner stimmt auch die Angabe selbst nicht immer!
Beispiel: Intel(R) Pentium(R) III Xeon processor x86 Family 6 Model 23 Stepping 6 @ 2666 MHz
Abhilfe ist nur teilweise gemacht:
Windows versions NumberOfLogicalProcessors and NumberOfCores property can use.
NumberOfLogicalProcessors and NumberOfCores property can not use in Windows XP Service Pack 2 and earlier.
In Windows XP Service Pack 3, NumberOfLogicalProcessors and NumberOfCores property is available.
In Windows Server 2003 Service Pack 2 and earlier, NumberOfLogicalProcessors and NumberOfCores property is not available. But applied KB932370 hotfix, NumberOfLogicalProcessors and NumberOfCores property is available.See
The number of physical hyperthreading-enabled processors or the number of physical multicore processors is incorrectly reported in Windows Server 2003
http://support.microsoft.com/kb/932370/
In Windows Vista, NumberOfLogicalProcessors and NumberOfCores property is available.
Quelle: http://msdn.microsoft.com/en-us/library/…28VS.85%29.aspx
Gruß,
UEZ