SHFullScreen (Compact 2013)

3/28/2014

This function sets the application to display in full-screen mode, which modifies the taskbar, Input Panel button, or Start menu icon so that the application's UI covers the complete screen.

Syntax

BOOL SHFullScreen(
  HWND hwndRequester,
  DWORD dwState
);

Parameters

  • hwndRequester
    [in] Handle to the top-level window requesting the full-screen state. If you are using one of the SHFS_HIDE* flags, this window must be the foreground window or the function will fail.
  • dwState
    [in] Specifies the state of the window. The following table shows the possible values for this parameter.

    State

    Description

    SHFS_SHOWTASKBAR

    Return the taskbar to its topmost state.

    SHFS_HIDETASKBAR

    Put the taskbar directly behind the foreground window in the z-order.

    Ee499392.note(en-us,WinEmbedded.80).gifNote:
    The taskbar will not update after a status change on the device has occurred. For example, if the text on the taskbar changes or if the cellular connection type of the device changes, the taskbar will not update. If you need the taskbar to update, you can use the SHFS_DEFAULT flag.

    Note that a game or an application that requires the entire screen may use this flag. Be sure that your application is sized to full screen before using this flag. Otherwise, it will appear as though the function did nothing.

Return Value

This function returns TRUE if it is successful and FALSE if it is not successful.

Remarks

For central menu override mode, an application calls this function to hide the soft key bar.

Code Example

The following code example demonstrates how to use SHFullScreen.

Note

To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.

#include <aygshell.h>
LRESULT CALLBACK SHFullScreenWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    static fFullScreen = FALSE;
    switch (message)
    {
        case WM_KEYDOWN:
        {
            // Toggle between full screen and normal mode when the user presses the space bar.
            if (VK_SPACE == wParam)
            {
                DWORD dwState;
                RECT rc;
                if (fFullScreen)
                {
                    // To switch to normal mode, first show all of the shell parts.
                    dwState = (SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON);
                    SHFullScreen(hwnd, dwState);
                    // Next resize the main window to the size of the work area.
                    SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, FALSE);
                    MoveWindow(hwnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);
                    fFullScreen = !fFullScreen;
                }
                else
                {
                    // To switch to full screen mode, first hide all of the shell parts.
                    dwState = (SHFS_HIDETASKBAR | SHFS_HIDESTARTICON);
                    SHFullScreen(hwnd, dwState);
                    // Next resize the main window to the size of the screen.
                    SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
                    MoveWindow(hwnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);
                    fFullScreen = !fFullScreen;
                }
            }
        }
        break;
    }
    return DefWindowProc(hwnd, message, wParam, lParam);
}

Requirements

Header

shellsdk.h

Library

aygshell.lib

See Also

Reference

Shell Functions
WM_LBUTTONDOWN
WM_LBUTTONUP