Reputation: 361
I need to identify a application(such games) window's state whether it running in fullscreen or not.
Is there any similar window styles such WS_MAXIMIZE,WS_MINIMIZE to check the full screen state of Window's Handler ?
Upvotes: 0
Views: 1497
Reputation: 645
In windows most applications don't have true fullscreen windows they just fill your entire screen and being called "fullscreen" it is true to a certain extent but they are ordinary windows. Thing is that Windows doesn't have a flag or a state for this, altho using D3D is diffrent since it can run in a true fullscreen mode which needs other methods to detect.
Your best bet to tell if its a fullscreen window is to compare the window size to the display's size. Like GetWindowRect ( or GetClientRect ) to get the window's size then to do it properly you need know know which display ( in case there are multiple monitors ) the window is originated from with MonitorFromWindow then you can query the monitor's size in pixels with GetMonitorInfo ( in the MONITORINFO structure you will get the screen's size in pixels ).
Now you know the screen's size and the window's size from this point it's up to you how you decide if it's fullscreen, you may compare for an exact match or give it some threshold and also check the position of the window.
You can also check a widely used window flag which is WS_EX_TOPMOST it's mostly used by OpenGL apps to give the illusion of a real fullscreen app, I would say if the window is WS_EX_TOPMOST and it's size is the same as the screen size you can be 90% sure it is a fullscreen game or something like that. I can't really give you any advice however on how to detect D3D fullscreen apps.
Upvotes: 1