public static void getWindowMonitorSize( IntPtr hwnd, out int x, out int y, out int width, out int height ) { IntPtr monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); MONITORINFO info = new MONITORINFO(); info.cbSize = Marshal.SizeOf(info); GetMonitorInfo(monitor, ref info); x = info.rcMonitor.X; y = info.rcMonitor.Y; width = info.rcMonitor.Width; height = info.rcMonitor.Height; }
static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFO lpmi);