EnumDisplayDevices (user32)
Last changed: -128.210.155.101

.
Summary

C# Signature:

[DllImport("user32.dll")]
static extern bool EnumDisplayDevices(string lpDevice, uint iDevNum,
   ref DISPLAY_DEVICE lpDisplayDevice, uint dwFlags);

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

    DISPLAY_DEVICE d=new DISPLAY_DEVICE();
    d.cb=Marshal.SizeOf(d);
    try {
        for (int id=0;EnumDisplayDevices(null, id, ref d, 0);id++) {
            Console.WriteLine(
                String.Format("{0}, {1}, {2}, {3}, {4}, {5}",
                         id,
                         d.DeviceName,
                         d.DeviceString,
                         d.StateFlags,
                         d.DeviceID,
                         d.DeviceKey
                         )
                          );
            d.cb=Marshal.SizeOf(d);
        }
    } catch (Exception ex) {
        Console.WriteLine(String.Format("{0}",ex.ToString()));
    }

Alternative Managed API:

Do you know one? Please contribute it!

Documentation