Yep, you're absolutly right. Next version will only contain resolutions >= 800x600 and Freq. <= 75 Hertz (don't want anyone to blow up his monitor). Thanks for the hint.
Thanks, did some research myself in the meantime and will implement this in the next version too, no WMI anymore.
; http://www.autoitscript.com/forum/index.php?showtopic=70679
; Mix from rasim and other replies
Global Const $EDS_RAWMODE = 0x2
Dim $DEVMODE, $DllRet
Global Const $ENUM_CURRENT_SETTINGS = -1
Global Const $ENUM_REGISTRY_SETTINGS = -2
Global $ENUM_ALL_SETTINGS = 0
$DEVMODE = DllStructCreate("char dmDeviceName[32];ushort dmSpecVersion;ushort dmDriverVersion;short dmSize;" & _
"ushort dmDriverExtra;dword dmFields;short dmOrientation;short dmPaperSize;short dmPaperLength;" & _
"short dmPaperWidth;short dmScale;short dmCopies;short dmDefaultSource;short dmPrintQuality;" & _
"short dmColor;short dmDuplex;short dmYResolution;short dmTTOption;short dmCollate;" & _
"byte dmFormName[32];dword dmBitsPerPel;int dmPelsWidth;dword dmPelsHeight;" & _
"dword dmDisplayFlags;dword dmDisplayFrequency")
DllStructSetData($DEVMODE, "dmSize", DllStructGetSize($DEVMODE))
; =============================================
Do
$DllRet = DllCall("user32.dll", "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_ALL_SETTINGS, _
"ptr", DllStructGetPtr($DEVMODE), "dword", 0)
$DllRet = $DllRet[0]
$ENUM_ALL_SETTINGS += 1
ConsoleWrite("Width = " & DllStructGetData($DEVMODE, "dmPelsWidth") & " " & _
"Height = " & DllStructGetData($DEVMODE, "dmPelsHeight") & " " & _
"Bits = " & DllStructGetData($DEVMODE, "dmBitsPerPel") & " " & _
"Frequency = " & DllStructGetData($DEVMODE, "dmDisplayFrequency") & @LF)
Until $DllRet = 0
; =============================================
ConsoleWrite("Current from Display" & @CRLF)
$DllRet = DllCall("user32.dll", "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_CURRENT_SETTINGS, _
"ptr", DllStructGetPtr($DEVMODE), "dword", 0)
$DllRet = $DllRet[0]
ConsoleWrite("Width = " & DllStructGetData($DEVMODE, "dmPelsWidth") & " " & _
"Height = " & DllStructGetData($DEVMODE, "dmPelsHeight") & " " & _
"Bits = " & DllStructGetData($DEVMODE, "dmBitsPerPel") & " " & _
"Frequency = " & DllStructGetData($DEVMODE, "dmDisplayFrequency") & @LF)
; =============================================
ConsoleWrite("Current from Registry" & @CRLF)
$DllRet = DllCall("user32.dll", "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_REGISTRY_SETTINGS, _
"ptr", DllStructGetPtr($DEVMODE), "dword", 0)
$DllRet = $DllRet[0]
ConsoleWrite("Width = " & DllStructGetData($DEVMODE, "dmPelsWidth") & " " & _
"Height = " & DllStructGetData($DEVMODE, "dmPelsHeight") & " " & _
"Bits = " & DllStructGetData($DEVMODE, "dmBitsPerPel") & " " & _
"Frequency = " & DllStructGetData($DEVMODE, "dmDisplayFrequency") & @LF)
; =============================================
ConsoleWrite(@CRLF & "First try to obtain from Display, then from Registry" & @CRLF)
$DllRet = DllCall("user32.dll", "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_CURRENT_SETTINGS, _
"ptr", DllStructGetPtr($DEVMODE), "dword", 0)
If $DllRet[0] = 0 Then
ConsoleWrite(@CRLF & "From reg" & @CRLF)
$DllRet = DllCall("user32.dll", "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_REGISTRY_SETTINGS, _
"ptr", DllStructGetPtr($DEVMODE), "dword", 0)
EndIf
ConsoleWrite("Width = " & DllStructGetData($DEVMODE, "dmPelsWidth") & " " & _
"Height = " & DllStructGetData($DEVMODE, "dmPelsHeight") & " " & _
"Bits = " & DllStructGetData($DEVMODE, "dmBitsPerPel") & " " & _
"Frequency = " & DllStructGetData($DEVMODE, "dmDisplayFrequency") & @LF)
; =============================================
$DEVMODE = 0