Click here to Skip to main content
15,889,655 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi every one!
I have seen all window of any application appears in fullscreen mode even already uncheck autohide taskbar. please help me how to fix this to normal view.

OS: Windows XP

thanks
Posted

1 solution

Herez the code to test whether your app is running in full screen mode or not.
C#
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
    public int Left;
    public int Top;
    public int Right;
    public int Bottom;
}

public bool IsFullScreen()
{
    bool runningFullScreen = false;
    RECT appBounds;
    Rectangle screenBounds;
    IntPtr hWnd;

    //get the dimensions of the active window
    hWnd = GetForegroundWindow();
    if (hWnd!=null && !hWnd.Equals(IntPtr.Zero))
    {
        //Check we haven't picked up the desktop or the shell
        if (!(hWnd.Equals(desktopHandle) || hWnd.Equals(shellHandle)))
        {
            GetWindowRect(hWnd, out appBounds);
            //determine if window is fullscreen
            screenBounds = Screen.FromHandle(hWnd).Bounds;
            if ((appBounds.Bottom - appBounds.Top) == screenBounds.Height && (appBounds.Right - appBounds.Left) == screenBounds.Width)
            {
                runningFullScreen = true;
            }
        }
    }
    return runningFullScreen;
}


Later, app can be set to normal mode from full screen, by reducing few screen co-ordinates values as:
C#
public void SetNormal()
{
    IntPtr hWnd;
    Rectangle screenBounds;

    //get the dimensions of the active window
    hWnd = GetForegroundWindow();
    screenBounds = Screen.FromHandle(hWnd).Bounds;
    screenBounds.Height -= 50;
    screenBounds.Width  -= 250;

}
 
Share this answer
 
Comments
Bun Leap_kh 6-Oct-11 23:51pm    
thanks for your reply.
i might asked the wrong question because i'm not fluent in English.
my question is, why all window of any application in that computer always appear in fullscreen mode. how to change it to normal view?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900