public static bool IsForegroundFullScreen(System.Windows.Forms.Screen screen) { if (screen == null) { screen = System.Windows.Forms.Screen.PrimaryScreen; } RECT2 rect = new RECT2(); IntPtr hWnd = (IntPtr)GetForegroundWindow(); GetWindowRect(new HandleRef(null, hWnd), ref rect); if (screen.Bounds.Width == (rect.right - rect.left) && screen.Bounds.Height == (rect.bottom - rect.top)) { return(true); } else { return(false); } }
private static extern bool GetWindowRect(HandleRef hWnd, [In, Out] ref RECT2 rect);