User32EnumDisplayDevices Method

Retrieves information about the display devices in the current session.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", BestFitMapping = false, ThrowOnUnmappableChar = true, 
	SetLastError = true)]
public static bool EnumDisplayDevices(
	string lpDevice,
	uint iDevNum,
	ref DisplayDevice refDisplayDevice,
	uint flags
)

Parameters

lpDevice  String
A pointer to the device name.

If , the function returns information for the display adapter(s) on the machine, based on iDevNum.

iDevNum  UInt32
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.

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

Before calling EnumDisplayDevices(String, UInt32, DisplayDevice, UInt32), you must initialize the SizeOfStruct to the size, in bytes, of DisplayDevice.

flags  UInt32
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 returned in refDisplayDevice.

The resulting device interface name can be used with SetupAPI functions and serves as a link between GDI monitor devices and SetupAPI monitor devices.

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is .

The function fails if iDevNum is greater than the largest device index.

Remarks

See Also