Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

DISPLAY_DEVICE (Structures)
 
.
Summary

C# Definition:

[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
public struct DISPLAY_DEVICE
{
      [MarshalAs(UnmanagedType.U4)]
      public int cb;
      [MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)]
      public string DeviceName;
      [MarshalAs(UnmanagedType.ByValTStr, SizeConst=128)]
      public string DeviceString;
      [MarshalAs(UnmanagedType.U4)]
      public DisplayDeviceStateFlags StateFlags;
      [MarshalAs(UnmanagedType.ByValTStr, SizeConst=128)]
      public string DeviceID;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst=128)]
      public string DeviceKey;
}

VB.NET Definition:

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
Public Structure DISPLAY_DEVICE
    <MarshalAs(UnmanagedType.U4)> _
    Public cb As Integer
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> _
    Public DeviceName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> _
    Public DeviceString As String
    <MarshalAs(UnmanagedType.U4)> _
    Public StateFlags As DisplayDeviceStateFlags
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> _
    Public DeviceID As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> _
    Public DeviceKey As String
End Structure

User-Defined Types

DisplayDeviceStateFlags

Notes:

Used with EnumDisplayDevices

Works much better on Win7 with CharSet=CharSet.Auto. Suspect this is true of a bunch of other structs defined on this site as well as with at least a few predecessors of Win7.

With Win10/x64/.Net x64 needs CharSet = CharSet.Ansi

With Win10/x64 needs CharSet = CharSet.Ansi

Documentation

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions