From 51716e289857a343eaa34dfb9b85c284734d3cca Mon Sep 17 00:00:00 2001 From: dahall Date: Thu, 6 Aug 2020 12:52:15 -0600 Subject: [PATCH] Addressed #155 by adding GetMonitorInfo overload that accepts MONITORINFOEX --- PInvoke/User32/WinUser.Monitor.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/PInvoke/User32/WinUser.Monitor.cs b/PInvoke/User32/WinUser.Monitor.cs index 1b61617c..5420f7e8 100644 --- a/PInvoke/User32/WinUser.Monitor.cs +++ b/PInvoke/User32/WinUser.Monitor.cs @@ -532,6 +532,35 @@ namespace Vanara.PInvoke [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetMonitorInfo(HMONITOR hMonitor, ref MONITORINFO lpmi); + /// + /// The GetMonitorInfo function retrieves information about a display monitor. + /// + /// + /// A handle to the display monitor of interest. + /// + /// + /// A pointer to a MONITORINFO or MONITORINFOEX structure that receives information about the specified display monitor. + /// + /// You must set the cbSize member of the structure to sizeof(MONITORINFO) or sizeof(MONITORINFOEX) before calling the + /// GetMonitorInfo function. Doing so lets the function determine the type of structure you are passing to it. + /// + /// + /// The MONITORINFOEX structure is a superset of the MONITORINFO structure. It has one additional member: a string that contains a + /// name for the display monitor. Most applications have no use for a display monitor name, and so can save some bytes by using a + /// MONITORINFO structure. + /// + /// + /// + /// If the function succeeds, the return value is nonzero. + /// If the function fails, the return value is zero. + /// + // https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getmonitorinfoa BOOL GetMonitorInfoA( HMONITOR hMonitor, + // LPMONITORINFO lpmi ); + [DllImport(Lib.User32, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("winuser.h", MSDNShortId = "025a89c2-4bbd-4c8b-8367-3735fb5b872a")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool GetMonitorInfo(HMONITOR hMonitor, ref MONITORINFOEX lpmi); + /// /// The MonitorFromPoint function retrieves a handle to the display monitor that contains a specified point. ///