简体   繁体   English

检测全屏运行的窗口

[英]Detect window running in fullscreen

I currently have a program that compliments a flash game. 我目前有一个补充Flash游戏的程序。 One of the features it has is to "always stay on top" and this works really well until the game is put into full screen mode. 它具有的功能之一是“始终保持在最前面”,并且在将游戏置于全屏模式之前,它的效果非常好。 When flash enters full screen mode, the Windows taskbar disappears so the flash window can propagate the entire screen. 当闪光灯进入全屏模式时,Windows任务栏消失,因此闪光灯窗口可以传播整个屏幕。 My program stays on top like its supposed to but whenever focus is moved from the full screen flash window to my program, the windows taskbar appears. 我的程序像预期的那样停留在顶部,但是每当焦点从全屏Flash窗口移到我的程序时,就会出现Windows任务栏。

Usually, I would just hide the taskbar all the time with a call to FindWindow("Shell_TrayWnd", ""); 通常,我只会一直通过调用FindWindow("Shell_TrayWnd", "");隐藏任务栏FindWindow("Shell_TrayWnd", ""); then ShowWindow(_taskbarHandle, 0); 然后ShowWindow(_taskbarHandle, 0); . This works however I want the taskbar to be showing when the flash window isn't in full screen mode and my program is focused. 这可行,但是我希望在Flash窗口不在全屏模式下并且程序处于焦点状态时显示任务栏。 I've thought of trying to obtain a handle of the window, but with different browsers comes different class names. 我曾想过尝试获取窗口的句柄,但是使用不同的浏览器会带来不同的类名。

Does anyone have, or can think of, a reliable method for determining if a flash window is running in full screen? 是否有人拥有或可以想到一种确定Flash窗口是否正在全屏运行的可靠方法?

I've thought of polling GetActiveWindow every few seconds to obtain the currently active window handle but I still have no way of determining if its a flash window! 我已经考虑过每隔几秒钟轮询GetActiveWindow以获得当前活动的窗口句柄,但我仍然无法确定其是否为Flash窗口!

Is there a way to iterate through all the open windows and see if one has the width and height of the screen? 有没有办法遍历所有打开的窗口并查看屏幕是否具有屏幕的宽度和高度?

You can iterate through open windows using the EnumWindows function. 您可以使用EnumWindows函数在打开的窗口中进行迭代。 Alternatively, you could use WindowFromPoint to determine if there's a window at 0,0 and X-1,Y-1 (where X and Y are the width and height of the screen), and if so, if they're the same window. 或者,您可以使用WindowFromPoint确定在0,0和X-1,Y-1处是否有一个窗口(其中X和Y是屏幕的宽度和高度),如果是,则它们是否是同一窗口。

One other thing you could try, and I don't know if this will work or not, is to use the WS_EX_TOOLWINDOW extended window style for your custom window. 您可以尝试做的另一件事(我不知道这是否可行)是为您的自定义窗口使用WS_EX_TOOLWINDOW扩展窗口样式。 This will stop your window from appearing on the taskbar, and doing that may prevent the taskbar from coming to the front in the first place. 这将阻止您的窗口出现在任务栏上,并且这样做可能会阻止任务栏排在最前面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM