• All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class MONITORINFOEX
    extends Struct
    implements NativeResource
    Contains information about a display monitor.

    Member documentation

    • cbSize – the size, in bytes, of the structure.

      Set this member to SIZEOF before calling the User32.GetMonitorInfo(long, function. Doing so lets the function determine the type of structure you are passing to it.

    • rcMonitor – a RECT structure that specifies the display monitor rectangle, expressed in virtual-screen coordinates. Note that if the monitor is not the primary display monitor, some of the rectangle's coordinates may be negative values.
    • rcWork – a RECT structure that specifies the work area rectangle of the display monitor that can be used by applications, expressed in virtual-screen coordinates. Windows uses this rectangle to maximize an application on the monitor. The rest of the area in rcMonitor contains system windows such as the task bar and side bars. Note that if the monitor is not the primary display monitor, some of the rectangle's coordinates may be negative values.
    • dwFlags – the attributes of the display monitor. May be:
    • szDevice – a string that specifies the device name of the monitor being used


     struct MONITORINFOEX {
         DWORD cbSize;
         RECT rcMonitor;
         RECT rcWork;
         DWORD dwFlags;
         TCHAR szDevice[32];
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.

        The struct member offsets.
    • Constructor Detail


        public MONITORINFOEX​(java.nio.ByteBuffer container)
        Creates a MONITORINFOEX instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

        The created instance holds a strong reference to the container object.

    • Method Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • cbSize

        public int cbSize()
        Returns the value of the cbSize field.
      • rcMonitor

        public RECT rcMonitor()
        Returns a RECT view of the rcMonitor field.
      • rcMonitor

        public MONITORINFOEX rcMonitor​(java.util.function.Consumer<RECT> consumer)
        Passes the rcMonitor field to the specified Consumer.
      • rcWork

        public RECT rcWork()
        Returns a RECT view of the rcWork field.
      • rcWork

        public MONITORINFOEX rcWork​(java.util.function.Consumer<RECT> consumer)
        Passes the rcWork field to the specified Consumer.
      • dwFlags

        public int dwFlags()
        Returns the value of the dwFlags field.
      • szDevice

        public java.nio.ByteBuffer szDevice()
        Returns a ByteBuffer view of the szDevice field.
      • szDeviceString

        public java.lang.String szDeviceString()
        Decodes the null-terminated string stored in the szDevice field.
      • cbSize

        public MONITORINFOEX cbSize​(int value)
        Sets the specified value to the cbSize field.
      • set

        public MONITORINFOEX set​(MONITORINFOEX src)
        Copies the specified struct data to this struct.
        src - the source struct
        this struct
      • create

        public static MONITORINFOEX create​(long address)
        Returns a new MONITORINFOEX instance for the specified memory address.
      • createSafe

        public static MONITORINFOEX createSafe​(long address)
        Like create, but returns null if address is NULL.
      • create

        public static MONITORINFOEX.Buffer create​(long address,
                                                  int capacity)
        Create a MONITORINFOEX.Buffer instance at the specified memory.
        address - the memory address
        capacity - the buffer capacity
      • createSafe

        public static MONITORINFOEX.Buffer createSafe​(long address,
                                                      int capacity)
        Like create, but returns null if address is NULL.
      • callocStack

        public static MONITORINFOEX callocStack​(MemoryStack stack)
        Returns a new MONITORINFOEX instance allocated on the specified MemoryStack and initializes all its bits to zero.
        stack - the stack from which to allocate
      • ncbSize

        public static int ncbSize​(long struct)
        Unsafe version of cbSize().
      • nrcMonitor

        public static RECT nrcMonitor​(long struct)
        Unsafe version of rcMonitor().
      • nrcWork

        public static RECT nrcWork​(long struct)
        Unsafe version of rcWork().
      • ndwFlags

        public static int ndwFlags​(long struct)
        Unsafe version of dwFlags().
      • nszDevice

        public static java.nio.ByteBuffer nszDevice​(long struct)
        Unsafe version of szDevice().
      • nszDeviceString

        public static java.lang.String nszDeviceString​(long struct)
        Unsafe version of szDeviceString().
      • ncbSize

        public static void ncbSize​(long struct,
                                   int value)
        Unsafe version of cbSize.