Click to Rate and Give Feedback
MSDN
MSDN Library
EnumDisplayDevices

This content has moved to another location. See EnumDisplayDevices for the latest version.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
What's up with the value="s?      aaaaaaasssssss   |   Edit   |   Show History
Anybody else seeing a bunch of value="s sprinkled throughout the page?
Tags What's this?: Add a tag
Flag as ContentBug
Implication about adapter name is incorrect      skst   |   Edit   |   Show History

The sentence "Note thatDISPLAY_DEVICE.DeviceName changes with each call for monitor information, so you must save the adapter name." implies that the adapter name is stored in DeviceName, but it's stored in DeviceString (as mentioned in an earlier paragraph). Although, it does appear as if this mechanism requires DeviceName (not the adapter name).

The doc for the embedded version is a bit clearer, but apparently still inaccurate.

"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."

When I follow this doc and call with lpDevice set to \\.\DISPLAY1 (and again with \\.\DISPLAY1 (and again with \\.\DISPLAY2) and iDevNum set to 0, the monitor names are the same. (I have two monitors connected to a single video card--nVidia 8600GT.) But it does work on another system (with an ATi X300 Radeon card).

Here's what really happens. You call EnumDisplayDevices with NULL and increment the index from 0 to whenever the call fails. Each call returns information about an adapter (adapter name in DeviceString and device name in DeviceString). The state flags indicate if the monitor that's connected to this adapter's interface is attached to the desktop and if it's primary.

For each adapter, you can call EnumDisplayDevices with the device name and increment the index from 0 to whenever the call fails. Each call returns information about a monitor that could be connected to the device. The monitor that's actually connected to the device returns DISPLAY_DEVICE_ATTACHED_TO_DESKTOP in the state flags.

Some sample code would be nice for tortuous APIs such as this one.

Yes, I see the value="s as well.

dwFlags is reserved?      Faux   |   Edit   |   Show History
According to the declaration, dwFlags is //reserved, but it has documented values below?
Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker