2 out of 2 rated this helpful - Rate this topic

DISPLAY_DEVICE structure

Applies to: desktop apps only

The DISPLAY_DEVICE structure receives information about the display device specified by the iDevNum parameter of the EnumDisplayDevices function.

Syntax

typedef struct _DISPLAY_DEVICE {
  DWORD cb;
  TCHAR DeviceName[32];
  TCHAR DeviceString[128];
  DWORD StateFlags;
  TCHAR DeviceID[128];
  TCHAR DeviceKey[128];
} DISPLAY_DEVICE, *PDISPLAY_DEVICE;

Members

cb

Size, in bytes, of the DISPLAY_DEVICE structure. This must be initialized prior to calling EnumDisplayDevices.

DeviceName

An array of characters identifying the device name. This is either the adapter device or the monitor device.

DeviceString

An array of characters containing the device context string. This is either a description of the display adapter or of the display monitor.

StateFlags

Device state flags. It can be any reasonable combination of the following.

ValueMeaning
DISPLAY_DEVICE_ACTIVEDISPLAY_DEVICE_ACTIVE specifies whether a monitor is presented as being "on" by the respective GDI view.

Windows Vista: EnumDisplayDevices will only enumerate monitors that can be presented as being "on."

DISPLAY_DEVICE_MIRRORING_DRIVERRepresents a pseudo device used to mirror application drawing for remoting or other purposes. An invisible pseudo monitor is associated with this device. For example, NetMeeting uses it. Note that GetSystemMetrics (SM_MONITORS) only accounts for visible display monitors.
DISPLAY_DEVICE_MODESPRUNEDThe device has more display modes than its output devices support.
DISPLAY_DEVICE_PRIMARY_DEVICEThe primary desktop is on the device. For a system with a single display card, this is always set. For a system with multiple display cards, only one device can have this set.
DISPLAY_DEVICE_REMOVABLEThe device is removable; it cannot be the primary display.
DISPLAY_DEVICE_VGA_COMPATIBLEThe device is VGA compatible.

 

DeviceID

Not used.

DeviceKey

Reserved.

Remarks

The four string members are set based on the parameters passed to EnumDisplayDevices. If the lpDevice param is NULL, then DISPLAY_DEVICE is filled in with information about the display adapter(s). If it is a valid device name, then it is filled in with information about the monitor(s) for that device.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Wingdi.h (include Windows.h)

Unicode and ANSI names

DISPLAY_DEVICEW (Unicode) and DISPLAY_DEVICEA (ANSI)

See also

Device Contexts Overview
Device Context Structures
EnumDisplayDevices
GetSystemMetrics

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
DeviceID and DeviceKey have a value set
In docs it is said "Not used" for the DeviceID and DeviceKey fields.$0 It turns out these fields have a value set (in XP SP3)$0 DeviceID is the GUID of the display and DeviceKey is the registry key. $0$0 $0 $0See also EnumDisplayDevices() for the description of the dwFlags parameter that can be set to EDD_GET_DEVICE_INTERFACE_NAME (0x00000001) in order to retrieve the DeviceID field.$0 $0$0 $0 $0The DeviceKey field is used along with the DeviceID by the SetupAPI to link the display device with its display driver for monitors usable in the SetupAPI in order to make them a GDI-capable display device (also usable for DirectX accelerated APIs). In other contexts than installers (notably in applications without administrator privileges to change the list of installed devices), it should have no use.$0 $0$0 $0 $0The DeviceID is created during the display device installation (there's one configuration for each monitor and each display driver instance with which it has been connected; the display driver itself may change depending on Windows start mode, such as the failsafe mode, but note that EDD info is not available with the generic failsafe "VGASAVE" display driver), and registered to be unique on a system, and stored in this registry key. The DeviceID is independant of the fact that a monitor is the primary monitor or not (the primary monitor uses the start location (0,0) and other monitors are placed in non overlapping rectangles.$0 $0$0 $0 $0Unfortunately, there's no simple API in GDI for retrieving the display device capabilities per monitor, only the capabilities of the primary monitor is retrieved (for exampel monitors can have different physical pixel sizes, different color depths, different color profiles, different refresh rates, and this can influence some rendering capabilities such as ClearType, if a window is moved partially or fully onto a non-primary monitor... Multiple monitors may also be controled by distinct drivers for distinct display adapters with distinct hardware acceleration capabilities such as clipping, gradient fills, alpha support, distinct alignment preferences...)$0 $0$0 $0 $0See also GetDeviceCaps() when passing a NULL hDC: it only returns info about the primary monitor.$0 $0$0 $0 $0There should be a stable API to retrive a usable DC for the non-primary monitors, such as:$0 $0 $0 $0- passing to GetDeviceCaps() the value (HDC)1 for the desktop window area on the second (non-primary) monitor, (HDC)2 for the desktop window area on the third monitor, and so on,$0 $0- or using getDCEx((HWND)NULL, (HRGN)monitorNumber, DCX_MONITOR) with a new flags value incompatible with other region-related flags and indicating that the region parameter is the wanted monitor number for which we want a usable HDC usable with GetDeviceCaps()...$0 $0 $0 $0$0 $0
DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
The DISPLAY_DEVICE_ATTACHED_TO_DESKTOP flag mentioned in other places is the same as the DISPLAY_DEVICE_ACTIVE flag, both are defined to the value of 1.
SM_MONITORS?
GetSystemMetrics (SM_MONITORS) - There is no such flag in GetSystemMetrics function, there is no similiar flag there. There is no link to this function (should be).