What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Detect Full Screen application

Detect Full Screen application
Author: Message:
J-Thread
Full Member
***

Avatar

Posts: 467
Reputation: 8
– / Male / –
Joined: Jul 2004
O.P. Detect Full Screen application
A very short question: How can I detect that there is a full screen application running? I tried the following code:
code:
// Check if full screen app is running
bool IsFullScreenAppRunning () {
    HWND hWnd = GetForegroundWindow();

    if(!hWnd)
        return false;

    RECT rc;
    if(!GetWindowRect(hWnd,&rc))
        return false;

    return (rc.right - rc.left  >= GetSystemMetrics(SM_CXSCREEN) &&  rc.bottom - rc.top >= GetSystemMetrics(SM_CYSCREEN));

}

But that has got 2 problems:
1. It returns true if my desktop is the foreground window (i.e. there aren't really any windows)
2. There can be another window on top of the fullscreen window, and then this function returns false, which is not what I want.

Does anybody know how to fix this? Using GetClientRect doesn't work either:(
10-07-2006 11:34 AM
Profile E-Mail PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: Detect Full Screen application
quote:
Originally posted by J-Thread
1. It returns true if my desktop is the foreground window (i.e. there aren't really any windows)
I believe you can test against this by comparing the hwnd returned by GetForegroundWindow with one returned by GetDesktopWindow(). :)
10-09-2006 01:47 PM
Profile PM Web Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: Detect Full Screen application
Enumerate every HWND except GetDesktopWindow() to see if they have the metrics of the screen?
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
10-09-2006 01:58 PM
Profile PM Web Find Quote Report
J-Thread
Full Member
***

Avatar

Posts: 467
Reputation: 8
– / Male / –
Joined: Jul 2004
O.P. RE: Detect Full Screen application
Both sound good but don't work...:(

Somehow, GetDesktopWindow() returns a different HWND then GetForegroundWindow() when my desktop is the foreground window (so all my windows are minimalized).

The problem with enumerating all windows is that EnumWindows uses a callback function to return the results. So I cannot use that in my IsFullScreenAppRunning() function to return either true or false...

Thanks for your help anyway;)

This post was edited on 10-09-2006 at 02:52 PM by J-Thread.
10-09-2006 02:51 PM
Profile E-Mail PM Find Quote Report
Ash_
Senior Member
****

Avatar

Posts: 638
Reputation: 31
35 / Male / –
Joined: Aug 2004
RE: Detect Full Screen application
psuedocode
code:
H = GetForeGroundWindow()
  if (IsWindowVisible(H) and not IsIconic(H) and IsZoomed(H)) then window is Fullscreen


untested as i dont have any compilers installed atm but those 4 API calls should produce what you need.

This post was edited on 10-09-2006 at 05:06 PM by Ash_.
[Image: jeansiger5.jpg]
10-09-2006 05:06 PM
Profile PM Find Quote Report
J-Thread
Full Member
***

Avatar

Posts: 467
Reputation: 8
– / Male / –
Joined: Jul 2004
O.P. RE: Detect Full Screen application
Edit: Err I should test a bit more before posting... That code also returns true on maximized windows. The following code solves problem 1:

code:
// Check if full screen app is running
bool IsFullScreenAppRunning () {
    HWND hWnd = GetForegroundWindow();

    if(!hWnd)
        return false;

    if(!IsWindowVisible(hWnd) || IsIconic(hWnd) || !IsZoomed(hWnd))
        return false;

    RECT rc;
    if(!GetWindowRect(hWnd,&rc))
        return false;

    return (rc.right - rc.left  >= GetSystemMetrics(SM_CXSCREEN) &&  rc.bottom - rc.top >= GetSystemMetrics(SM_CYSCREEN));
}

But the second problem still exists...

This post was edited on 10-09-2006 at 09:10 PM by J-Thread.
10-09-2006 05:16 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On