Click here to Skip to main content
Click here to Skip to main content
Go to top

Full Screen Application: Windows CE and Pocket PC

, 14 Jun 2007
Rate this:
Please Sign up or sign in to vote.
Making a full screen application for Windows CE and Pocket PC devices.

Screenshot - fullpocket.jpgScreenshot - fullCE.jpg


Many developers must include a "full screen" feature into their applications. In this article, I am focusing on Pocket PC and Windows CE devices. I've tried to introduce a universal solution for PDA software developers using the .NET Compact Framework that will enable them to include a full screen mode on both platforms, without requiring recompilation or code changes.


Why do we need a full screen mode on our PDAs? My three main reasons are:

  • To disable user interaction and access other programs on the device
  • To make full use of the screen space
  • To customize forms

Using the code

There are three steps to my full screen solution.

  1. Detecting the platform type by invoking Windows API and changing the form behavior accordingly:

    Platform type detection is a simple call to SystemParametersInfo to find whether you are running on a Smartphone or a Pocket PC. You need a few constants defined and the P/Invoke marshaling code to make it work from managed code. I am using SystemParametersInfo4Strings P/Invoke to detect if the device is a Pocket PC or not.

    public enum SystemParametersInfoActions : uint
        // this is used elsewhere for Smartphone/PocketPC detection
    /// Get Platform Type: Pocket Pc or Windows CE
    public static string GetPlatformType()
        StringBuilder platformType = new StringBuilder(50);
        if (SystemParametersInfo4Strings(
            (uint)platformType.Capacity, platformType, 0) == 0)
            throw new Exception("Error getting platform type.");
        return platformType.ToString();

    Platform detection method:

    /// Platform Detections methods
    internal partial class PlatformDetection
        public static bool IsSmartphone()
            return PInvoke.GetPlatformType() == "SmartPhone";
        public static bool IsPocketPC()
            return PInvoke.GetPlatformType() == "PocketPC";

    P/Invoke descriptions:

    //to find whether you are running on a Smartphone or a Pocket PC
    [DllImport("Coredll.dll", EntryPoint = "SystemParametersInfoW", 
        CharSet = CharSet.Unicode)]
    tatic extern int SystemParametersInfo4Strings(uint uiAction, 
        uint uiParam, StringBuilder pvParam, uint fWinIni);
    //The GetCapture function retrieves a handle to the window  
    private static extern IntPtr GetCapture();
    //The SetCapture function sets the mouse capture to
    //the specified window belonging to the current thread   
    private static extern IntPtr SetCapture(IntPtr hWnd);
    //This function can be used to take over certain areas of the screen
    //It is used to modify the taskbar, Input Panel button,
    //or Start menu icon.
    [DllImport("aygshell.dll", SetLastError = true)]
    private static extern bool SHFullScreen(IntPtr hwnd, int state);
    //The function retrieves the handle to the top-level 
    //window whose class name and window name match 
    //the specified strings. This function does not search child windows.
    [DllImport("coredll.dll", SetLastError = true)]
    private static extern IntPtr FindWindowW(string lpClass, string
    //changes the position and dimensions of the specified window
    [DllImport("coredll.dll", SetLastError = true)]
    private static extern IntPtr MoveWindow(IntPtr hwnd, int x, 
        int y, int w, int l, int repaint);

    This code is of the "set full screen" method:

    //if not Pocket PC platform
    if (!Platform.PlatformDetection.IsPocketPC()) 
        //Set Full Screen For Windows CE Device
        //Normalize windows state
        form.WindowState = FormWindowState.Normal;
        IntPtr iptr = form.Handle;
        SHFullScreen(iptr, (int)FullScreenFlags.HideStartIcon);
        //detect taskbar height
        int taskbarHeight = 
            Screen.PrimaryScreen.Bounds.Height - 
        // move the viewing window north taskbar 
        // height to get rid of the command bar 
        MoveWindow(iptr, 0, -taskbarHeight, 
            Screen.PrimaryScreen.Bounds.Height + taskbarHeight, 1);
        // move the task bar south taskbar height so that it's 
        // not visible anylonger 
        IntPtr iptrTB = FindWindowW("HHTaskBar", null);
        MoveWindow(iptrTB, 0, Screen.PrimaryScreen.Bounds.Height, 
            Screen.PrimaryScreen.Bounds.Width, taskbarHeight, 1);
    else //pocket pc platform
        //Set Full Screen For Pocket Pc Device
        form.Menu = null;
        form.ControlBox = false;
        form.FormBorderStyle = FormBorderStyle.None;
        form.WindowState = FormWindowState.Maximized;
        form.Text = string.Empty;
  2. Calling the form load event's "make full screen" method:
    private void MainForm_Load(object sender, EventArgs e)
  3. Calling the form closing event's "remove full screen" method:
    private void MainForm_Closing(object sender, CancelEventArgs e)

What is next?

In addition, you can customize forms as well as set your own title with battery life and your own close button. Let's do it!


  • 7 June, 2007 -- Original article posted
  • 13 June, 2007 -- Updated
  • 14 June, 2007 -- Updated some more


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


About the Author

Oleg Levin
Software Developer SoftSolutions
Israel Israel
No Biography provided

Comments and Discussions

QuestionHow to do MDI applications in Windows CE 5.0 (.Net) PinmemberSanShark20-Jan-09 21:12 
AnswerRe: How to do MDI applications in Windows CE 5.0 (.Net) PinmemberOleg Levin21-Jan-09 9:49 
Questionbackground image? PinmemberAlessandro7-Jul-08 0:49 
AnswerRe: background image? PinmemberOleg Levin7-Jul-08 1:32 
Generalhide the SIP keyboard icon Pinmemberram krishna pattnayak25-Mar-08 22:10 
GeneralRe: hide the SIP keyboard icon PinmemberOleg Levin26-Mar-08 4:21 
GeneralRe: hide the SIP keyboard icon Pinmemberram krishna pattnayak26-Mar-08 4:45 
GeneralRe: hide the SIP keyboard icon PinmemberOleg Levin26-Mar-08 18:36 
QuestionWhat about restoring?... PinmemberWin32nipuh7-Nov-07 20:51 
GeneralMaximized PinmemberDali Hammadi16-Aug-07 8:08 
GeneralTweak for Smartphone Mobile 5 Pinmembertban200330-Jul-07 12:12 
Questionwhy use partial class PinmemberDavid J Gu3-Jul-07 4:05 
AnswerRe: why use partial class PinmemberOleg Levin3-Jul-07 4:26 
GeneralFormWindowState.Maximized Pinmemberronzulu16-Jun-07 21:04 
GeneralMissing Information PinmemberNiteman12-Jun-07 21:18 
GeneralRe: Missing Information [modified] PinmemberOleg Levin12-Jun-07 21:32 
GeneralRe: Missing Information PinmemberNiteman12-Jun-07 21:55 
QuestionWorks for all resolutions? Pinmemberlonifasiko12-Jun-07 0:56 
Always supposing you've got a 240x320 resolution display...
I understand it's pretty much the same for other different resolutions or the 24 pixels you play with, vary on other resolutions?
I personally use a little class to hide "TaskBar":

using System;
using System.Runtime.InteropServices;
namespace PPC.Utilities
public sealed class TaskBar
private const int SW_HIDE = 0x0000;
private const int SW_SHOW = 0x0001;
private const string TASKBAR_PARAMETER = "HHTaskBar";
/// Hides the taskbar so that the user cannot tap into "Start" and exit the application

public static void Hide()
int h = FindWindow(TASKBAR_PARAMETER, "");
ShowWindow(h, SW_HIDE);
/// Shows the taskbar so that the user can tap into "Start"

public static void Show()
int h = FindWindow(TASKBAR_PARAMETER, "");
ShowWindow(h, SW_SHOW);
private static extern int FindWindow(string lpClassName, string lpWindowName);
private static extern int ShowWindow(int hwnd, int nTaskShow);
private static extern int MoveWindow(IntPtr hwnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);

And appart from calling "Hide" method inside this class, in order to all forms appear maximized, there are some properties that must be set for each form of the application:

/// Sets the target form to kiosk mode

public static void SetFormToKioskMode(Form target)
target.Text = "";
target.MaximizeBox = false;
target.MinimizeBox = false;
target.ControlBox = false;
target.FormBorderStyle = FormBorderStyle.None;
target.WindowState = FormWindowState.Maximized;

Nice trick! I'l try it out in my next project!
"Rezad a vuestros Dioses, amad a vuestras mujeres y luchad por vuestra patria!"

AnswerRe: Works for all resolutions? PinmemberOleg Levin12-Jun-07 1:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140921.1 | Last Updated 14 Jun 2007
Article Copyright 2007 by Oleg Levin
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid