EnumDisplayDevices (user32)
Last changed: -88.69.25.3

.
Summary

C# Signature:

[DllImport("user32.dll")]
static extern bool EnumDisplayDevices(string lpDevice, uint iDevNum,
   out 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);
            int id=0;
            try {
            while (EnumDisplayDevices(null, id, out d, 0)) {
                Console.WriteLine(
                   String.Format("{0}, {1}, {2}, {3}, {4}, {5}",
                         id,
                         d.DeviceName,
                         d.DeviceString,
                         d.StateFlags,
                         d.DeviceID,
                         d.DeviceKey
                         )
                          );
                id++;
                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