Function Reference


_WinAPI_EnumDisplaySettings

Retrieves information about one of the graphics modes for a display device

#include <WinAPIGdi.au3>
_WinAPI_EnumDisplaySettings ( $sDevice, $iMode )

Parameters

$sDevice The display device about whose graphics mode the function will obtain information.
An empty string specifies the current display device on the computer on which the calling process is running.
$iMode The type of information to be retrieved. This value can be a graphics mode index or one of the following values:
    $ENUM_CURRENT_SETTINGS
    $ENUM_REGISTRY_SETTINGS
The graphics mode indexes start at zero.
To obtain information for all of a display device's graphics modes, make a series of calls to _WinAPI_EnumDisplaySettings().
Set $iMode to zero for the first call, and increment $iMode by one for each subsequent call.
Continue calling the function until the return value is zero.
When you call _WinAPI_EnumDisplaySettings() with $iMode set to zero, the operating system initializes and caches information about the display device.
When you call _WinAPI_EnumDisplaySettings() with $iMode set to a non-zero value, the function returns the information that was cached the last time the function was called with $iMode set to zero.

Return Value

Success: The array containing the following information:
    [0] - The width, in pixels, of the visible device surface.
    [1] - The height, in pixels, of the visible device surface.
    [2] - The color resolution, in bits per pixel, of the display device.
    [3] - The frequency, in hertz (cycles per second), of the display device in a particular mode.
    [4] - The device's display mode ($DM_*).
Failure: Sets the @error flag to non-zero.

See Also

Search EnumDisplaySettings in MSDN Library.

Example

#include <APIGdiConstants.au3>
#include <WinAPIGdi.au3>

Local $i = 0, $aData

While 1
        $aData = _WinAPI_EnumDisplaySettings('', $i)
        If IsArray($aData) Then
                ConsoleWrite($aData[0] & ' x ' & $aData[1] & ' x ' & $aData[2] & ' bit' & @CRLF)
        Else
                ExitLoop
        EndIf
        $i += 1
WEnd

$aData = _WinAPI_EnumDisplaySettings('', $ENUM_CURRENT_SETTINGS)
ConsoleWrite('-------------------------------' & @CRLF)
ConsoleWrite('Current settings: ' & $aData[0] & ' x ' & $aData[1] & ' x ' & $aData[2] & ' bit' & @CRLF)