Skip to content

Latest commit

 

History

History
138 lines (86 loc) · 6.43 KB

nf-winuser-enumdisplaydevicesw.md

File metadata and controls

138 lines (86 loc) · 6.43 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name req.apiset
NF:winuser.EnumDisplayDevicesW
EnumDisplayDevicesW function (winuser.h)
The EnumDisplayDevices function lets you obtain information about the display devices in the current session. (Unicode)
EnumDisplayDevices
EnumDisplayDevices function [Windows GDI]
EnumDisplayDevicesW
_win32_EnumDisplayDevices
gdi.enumdisplaydevices
winuser/EnumDisplayDevices
winuser/EnumDisplayDevicesW
gdi\enumdisplaydevices.htm
gdi
df3b493c-23d2-4996-9b79-86009efe3078
12/05/2018
EnumDisplayDevices, EnumDisplayDevices function [Windows GDI], EnumDisplayDevicesA, EnumDisplayDevicesW, _win32_EnumDisplayDevices, gdi.enumdisplaydevices, winuser/EnumDisplayDevices, winuser/EnumDisplayDevicesA, winuser/EnumDisplayDevicesW
winuser.h
Windows.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
EnumDisplayDevicesW (Unicode) and EnumDisplayDevicesA (ANSI)
User32.lib
User32.dll
Windows
19H1
EnumDisplayDevicesW
winuser/EnumDisplayDevicesW
c++
APIRef
kbSyntax
DllExport
User32.dll
Ext-MS-Win-RTCore-NTUser-sysparams-l1-1-0.dll
minuser.dll
api-ms-win-ntuser-sysparams-l1-1-0.dll
EnumDisplayDevices
EnumDisplayDevicesA
EnumDisplayDevicesW
ext-ms-win-ntuser-sysparams-ext-l1-1-1 (introduced in Windows 10, version 10.0.14393)

EnumDisplayDevicesW function

-description

The EnumDisplayDevices function lets you obtain information about the display devices in the current session.

-parameters

-param lpDevice [in]

A pointer to the device name. If NULL, function returns information for the display adapter(s) on the machine, based on iDevNum.

For more information, see Remarks.

-param iDevNum [in]

An index value that specifies the display device of interest.

The operating system identifies each display device in the current session with an index value. The index values are consecutive integers, starting at 0. If the current session has three display devices, for example, they are specified by the index values 0, 1, and 2.

-param lpDisplayDevice [out]

A pointer to a DISPLAY_DEVICE structure that receives information about the display device specified by iDevNum.

Before calling EnumDisplayDevices, you must initialize the cb member of DISPLAY_DEVICE to the size, in bytes, of DISPLAY_DEVICE.

-param dwFlags [in]

Set this flag to EDD_GET_DEVICE_INTERFACE_NAME (0x00000001) to retrieve the device interface name for GUID_DEVINTERFACE_MONITOR, which is registered by the operating system on a per monitor basis. The value is placed in the DeviceID member of the DISPLAY_DEVICE structure returned in lpDisplayDevice. The resulting device interface name can be used with SetupAPI functions and serves as a link between GDI monitor devices and SetupAPI monitor devices.

-returns

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. The function fails if iDevNum is greater than the largest device index.

-remarks

To query all display devices in the current session, call this function in a loop, starting with iDevNum set to 0, and incrementing iDevNum until the function fails. To select all display devices in the desktop, use only the display devices that have the DISPLAY_DEVICE_ATTACHED_TO_DESKTOP flag in the DISPLAY_DEVICE structure.

To get information on the display adapter, call EnumDisplayDevices with lpDevice set to NULL. For example, DISPLAY_DEVICE.DeviceString contains the adapter name.

To obtain information on a display monitor, first call EnumDisplayDevices with lpDevice set to NULL. Then call EnumDisplayDevices with lpDevice set to DISPLAY_DEVICE.DeviceName from the first call to EnumDisplayDevices and with iDevNum set to zero. Then DISPLAY_DEVICE.DeviceString is the monitor name.

To query all monitor devices associated with an adapter, call EnumDisplayDevices in a loop with lpDevice set to the adapter name, iDevNum set to start at 0, and iDevNum set to increment until the function fails. Note that DISPLAY_DEVICE.DeviceName changes with each call for monitor information, so you must save the adapter name. The function fails when there are no more monitors for the adapter.

Note

The winuser.h header defines EnumDisplayDevices as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

-see-also

ChangeDisplaySettings

ChangeDisplaySettingsEx

CreateDC

DEVMODE

DISPLAY_DEVICE

Device Context Functions

Device Contexts Overview

EnumDisplaySettings