Detect if user has any application running in fullscreen [duplicate]

倾然丶 夕夏残阳落幕 提交于 2019-11-27 01:57:16

问题


This question already has an answer here:

  • Is there a way to check to see if another program is running full screen 2 answers

I did a notifier app in C# that sits on the taskbar and display a balloon when I get something from it, similar to Google Talk when you receive a new email but at the momment it ignores if I am running an application on fullscreen or not and just do it is job.

How can I detect and make sure an application is in fullscreen mode? I don't mean maximized (as an app could be maximized on your screen but still not in fullscreen) mode but true fullscreen.

For example when you run a game most will run in fullscreen mode.

Initially GetForegroundWindow() and GetWindowRect() came to my mind but even so I could make a window go larger then my screen if I am not on fullscreen which wouldn't help me so I am wondering if there are other flags or ways to approach this?


回答1:


For PowerPoint, see this MS KB article here: http://support.microsoft.com/kb/913045

Screen Saver: Windows API: FindWindow("WindowsScreenSaverClass"). (For more details see this web article: http://bobmoore.mvps.org/Win32/w32tip22.htm - it has a more detailsd way to do it, but I think FindWindow will work ok for you)

For detecting if a full screen game is in use: IDirect3DDevice9::TestCooperativeLevel http://msdn.microsoft.com/en-us/library/bb174472(VS.85).aspx

Otherwise, I think you are on the right path with GetForegroundWindow, GetWindowRect, and other window positioning api.

Things get complicated with you have more than one monitor - so don't forget that scenario as it relates to your app.



来源:https://stackoverflow.com/questions/3536373/detect-if-user-has-any-application-running-in-fullscreen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!