Checking if a there is a Full Screen app running?
Checking if a there is a Full Screen app running?
I want to hide my app's window if a full screen app (a game) is running. How do I check if there is a full screen app running?
I misread your question then. I thought you were asking how to push someone else's program to the back if your game was full screen.
In that case it's the other application's responsibility to set itself as the foreground window at the top of the z-order (even if other windows are stickied). I don't see how you would be able to tell the difference between a full screen game and a window that's just taking up the whole screen.
Can you give an example where this is a problem?
In that case it's the other application's responsibility to set itself as the foreground window at the top of the z-order (even if other windows are stickied). I don't see how you would be able to tell the difference between a full screen game and a window that's just taking up the whole screen.
Can you give an example where this is a problem?
Get the foreground window and its Rect, then test to see if it overlaps your window.
Code: Select all
hwnd = GetForegroundWindow_()
rc.RECT
GetWindowRect_(hwnd,@rc)
rc\left
rc\top
rc\width
rc\height
;then test if over lapped
*shrug* maybe to turn off graphic updating etc. for a more "friendly" app? That's what I would do, no need to waste cpu if it can't be seen, and the user would appreciate the game getting some more cpu cycles.
idle's code isn't that bad, but I'm pretty damn sure there is a API somewhere one can query as well (for example good screensavers known when not to start, like when a fullscreen app is running, no idea how they get that state info though)
idle's code isn't that bad, but I'm pretty damn sure there is a API somewhere one can query as well (for example good screensavers known when not to start, like when a fullscreen app is running, no idea how they get that state info though)
Are you referring to a full screen application or a program which is running in as full screen exclusive? With the exception of full screen exclusive, which wouldn't be an issue to begin with, I don't see how you would be able to identify a legitimate window taking up the screen (like Word/Excel) vs a game.Rescator wrote:like when a fullscreen app is running ..
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
to my knowledge, this is not an issue of the screensaver, but an issue of the fullscreen-app that sets a flag for the API handling this.for example good screensavers known when not to start, like when a fullscreen app is running, no idea how they get that state info though
e.g. in GOM-Player you set a flag "disable screensaver while playback" in the preferences.
in some readmes of games I found the hint, to disable the screensavers if the switching on/off caused problems with the grafix.
additionally, there are multiple ways to do some "fullscreen".
a game can request some 'real' fullscreen,
or it could open a window and maximize this, changing main resolution or not,
or it can even output to the desktop background, what some older Sid Meiers's products seem to do.
idle's code is a nice approach, though I'm not sure if the foreground-thingy applies to all kinds of fullscreens on all WinOS.
I would test it against Civ3 on Win2K....
(on win2K a fullscreen really was a different graphic mode with an own output.
from XP on it's integrated as a maximized window, what changes the handling somehow.)
regarding all this, I think it's a rather desperate job to determine if you should call the current top output some "fullscreen" or not.
I would recommend a very conveniant hotkey to switch the visibility of the clock on/off.
oh... and have a nice day.
off topic
You can also set it directly in the registry.
you can always get the state but I don't think you can always disable it this way, probably depends if it's password protected.Rescator wrote:(for example good screensavers known when not to start, like when a fullscreen app is running, no idea how they get that state info though)
You can also set it directly in the registry.
Code: Select all
result.l
retval = SystemParametersInfo_(#SPI_GETSCREENSAVEACTIVE, 0, @result, 0)
If result
lActive.l = #False ;disable it
retval = SystemParametersInfo_(#SPI_SETSCREENSAVEACTIVE, lActive, 0, 0)
EndIf
Re: Checking if a there is a Full Screen app running?
> How do I check if there is a full screen app running?
I saw this once on Usenet and took a snapshot. I can't find the actual post
anymore with Google Groups for some reason. Maybe it was removed?

I saw this once on Usenet and took a snapshot. I can't find the actual post
anymore with Google Groups for some reason. Maybe it was removed?

I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
I'm a bit confused by the original post.
I tested with one of my own apps which has a tool window (no title, sticky mode etc) it stays on top of everything, but if I do a fullscreen (like a movie player) it does not stay on top. Windows does this automatically.
So if the original app mentioned still stays on top then something not so system friendly is going on and some other window flags should maybe be used?
Also, if it's a clock I assume it only redraws once each second (anything else is a waste of resources).
And remember, if the user minimizes/hides the clock, it's smart to skip past the drawing part in the code until it's restored again.
...So the best solution is to...change nothing? *laughs*
I tested with one of my own apps which has a tool window (no title, sticky mode etc) it stays on top of everything, but if I do a fullscreen (like a movie player) it does not stay on top. Windows does this automatically.
So if the original app mentioned still stays on top then something not so system friendly is going on and some other window flags should maybe be used?
Also, if it's a clock I assume it only redraws once each second (anything else is a waste of resources).
And remember, if the user minimizes/hides the clock, it's smart to skip past the drawing part in the code until it's restored again.
...So the best solution is to...change nothing? *laughs*