Just like the question says. Can I see if someone else, program, is running full screen?
Full screen means that the entire screen is obscured, possibly running in a different video mode than the desktop.
Just like the question says. Can I see if someone else, program, is running full screen?
Full screen means that the entire screen is obscured, possibly running in a different video mode than the desktop.
Here is some code that does it. You want to take care about the multi screen case, especially with applications like Powerpoint
[StructLayout(LayoutKind.Sequential)]
private struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
[DllImport("user32.dll")]
private static extern bool GetWindowRect(HandleRef hWnd, [In, Out] ref RECT rect);
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
public static bool IsForegroundFullScreen()
{
return IsForegroundFullScreen(null);
}
public static bool IsForegroundFullScreen(Screen screen)
{
if (screen == null)
{
screen = Screen.PrimaryScreen;
}
RECT rect = new RECT();
GetWindowRect(new HandleRef(null, GetForegroundWindow()), ref rect);
return new Rectangle(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top).Contains(screen.Bounds);
}