有没有一种方法来检查是否有其他程序正在运行全屏 [英] Is there a way to check to see if another program is running full screen
本文介绍了有没有一种方法来检查是否有其他程序正在运行全屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
就像问题如是说。我可以看看别人,程序运行时全屏?
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.
推荐答案
下面是一些代码,做的。你要照顾有关多屏情况下,特别是如PowerPoint
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);
}
这篇关于有没有一种方法来检查是否有其他程序正在运行全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文