Export (0) Print
Expand All

Differences in Microsoft .NET Compact Framework Development between the Pocket PC and Windows CE .NET

.NET Compact Framework 1.0
 

Jim Wilson

March 2003

Applies to:
    Microsoft® .NET Compact Framework 1.0
    Microsoft® Visual Studio® .NET 2003

Summary: Learn the differences between developing Microsoft .NET Compact Framework-based applications for Pocket PC and Microsoft® Windows® CE .NET platforms. (7 printed pages)

Contents

Introduction
Application Lifecycle Management
Form Size and Position Options
Menus
TabControl
Input Panel
Non-Graphical and Console Applications
Debugging
Design Guidelines
Conclusion

Introduction

The .NET Compact Framework provides a powerful programming and execution environment for any smart device running Pocket PC 2000, Pocket PC 2002, Pocket PC 2003, Pocket PC Phone Edition, or Windows CE .NET 4.1 or above.

The Pocket PC family is a specialized version of Windows CE designed primarily for Personal Information Management (PIM) devices, whereas Windows CE .NET is a much more generalized platform running a wide array of devices. The nature of the individual platforms leads to some notable differences in the way applications are developed and behave.

Application Lifecycle Management

.NET Compact Framework-based applications running on the Pocket PC do not by default provide a close button; applications running on Windows CE do.

Pocket PC

For the convenience of Pocket PC users, applications designed for the Pocket PC normally remain running indefinitely to allow users to quickly move between applications. These applications cooperate with the Pocket PC's "smart minimize" feature, which allows the application to remain running in the background when not in use, and to be easily reactivated at the point in the application where the user left off. When an application is "smart minimized," it is not visible.

.NET Compact Framework-based applications running on the Pocket PC use the main Form's MinimizeBox property to control their "smart minimize" behavior. When MinimizeBox is set to true (the default), the application places an "X" button on the top of the form, as shown in Figure 1. Tapping the "X" "smart minimizes" the application.

Figure 1. Pocket PC application with MinimizeBox set to true (default)

When the main Form's MinimizeBox property is set to false, the application displays an "OK" button on the top of the form, as shown in Figure 2. When the "OK" is tapped, the application exits.

Figure 2. Pocket PC application with MinimizeBox set to false

Windows CE .NET

Windows CE applications employ an application lifecycle more consistent with Windows running on the desktop, displaying the standard "minimize," "maximize" and "close" buttons on the top of the form, as shown in Figure 3.

Figure 3. Windows CE application with default settings

Clicking the "minimize" button performs a traditional minimize, leaving the application visible on the taskbar. Clicking the "close" button exits the application. Having explicit "minimize" and "close" buttons eliminates the need to multiplex the MinimizeBox property, as on the Pocket PC. In this case, setting MinimizeBox to false simply displays the application without a "minimize" button, as shown in Figure 4. It has no affect on the lifecycle behavior of the application.

Figure 4. Windows CE application with MinimizeBox set to false

Form Size and Position Options

On the Pocket PC, all .NET Compact Framework forms are created as full-screen forms, ignoring the value of the Size and Location properties. On Windows CE, forms are created as defined by the Size and Location properties.

Pocket PC

Pocket PCs always have a screen size of 240x320 (usually less than 4" diagonally). If an application were to display multiple forms simultaneously on the small Pocket PC display, it would likely appear cluttered and be confusing to use. To avoid this problem, all Pocket PC forms created by the .NET Compact Framework occupy the entire display. This is true even if the application attempts to create the form sized smaller than the display. These full-screen forms cannot be resized or repositioned.

Windows CE

Windows CE has no specific screen size requirement, with many devices providing substantially large displays able to easily display multiple application forms. .NET Compact Framework-based applications running under Windows CE .NET are able to create forms of any size, at any position on the display. By default, these forms can be resized and repositioned in much the same way as forms created by the full .NET Framework running on the desktop.

Menus

.NET Compact Framework-based Pocket PC applications include a menu on the main form, by default, with all form menus positioned at the bottom of the display. On Windows CE .NET, the main application form is not initially created with a menu. If one is added, it is positioned at the top of the form.

Pocket PC

The Pocket PC defines a standard task bar at the bottom of the screen, used by all applications to display menu selections and to show/hide the input panel. When the user switches to a different application or form, the task bar always shows the menu associated with the currently active form. The .NET Compact Framework hides the taskbar if the active form does not have a menu associated; therefore, the main form is created with an associated menu to prevent the taskbar from being hidden.

Windows CE .NET

On Windows CE .NET, each application provides its own menu. Unlike the Pocket PC, associating a menu with a form does not have any side effects, so the decision to associate a menu with the form is left to the developer.

TabControl

On the Pocket PC, the .NET Compact Framework positions TabControls at the top edge of the form, filling the form from left to right, with the tabs positioned at the bottom of the control, as shown in Figure 5.

Figure 5. .NET Compact Framework TabControl on a Pocket PC

On Windows CE .NET, TabControls may be sized and positioned at any location on the form. The individual tabs are positioned at the top of the control.

Pocket PC

Users normally use a handheld stylus to make selections on the Pocket PC. The TabControl is positioned such that the user's hand will remain below the TabControl, and not cover the control when making a selection.

With the assistance of the Panel control, it is possible to position the TabControl at a location other than the top of the form. Simply place a Panel on the form, at the location where the TabControl is desired. Then place the TabControl within the Panel. The TabControl will then be positioned within the Panel, rather than the top edge of the form.

Windows CE

The wide variety of display sizes on Windows CE devices makes providing a single standard positioning policy for the TabControl impractical. In this case, the .NET Compact Framework leaves the TabControl positioning decision to the developer.

Input Panel

Most Pocket PCs do not have any form of a keyboard, but instead provide a software-based input panel (SIP) for data entry, as shown in Figure 6.

Figure 6. Pocket PC with a software-based input panel (SIP)

The .NET Compact Framework provides the InputPanel class for managing the SIP. The InputPanel is a Pocket PC-specific feature, and can only be created within a Pocket PC application. Attempting to create an instance of the InputPanel class in a Windows CE application will result in an error.

On the Pocket PC, the InputPanel allows applications to show/hide the SIP, identify screen space not covered by the SIP, and receive notifications indicating changes in the SIP visibility. The SIP is activated from the Pocket PC taskbar, and therefore requires that the taskbar be visible. In .NET Compact Framework-based applications, the taskbar is visible only if the active form has an associated menu. As a result, attempting to create an instance of the InputPanel on a form that does not have an associated menu will result in an error.

Non-Graphical and Console Applications

When creating a smart device project, the Smart Device Application Wizard provides the option to create a non-graphical application when targeting the Pocket PC; but when targeting Windows CE, it offers the option to create a console application instead.

Pocket PC

The Pocket PC does not have the concept of a console window. All applications must either provide a graphical window or be invisible. In the .NET Compact Framework, a non-graphical application is programmed similarly to a console application, with the exception of not supporting user I/O. The application is created without a form, and therefore cannot receive windows messages. Non-graphical applications are useful for performing background processing that does not require user interaction.

Windows CE .NET

Windows CE .NET supports a console window, and therefore supports the development of console applications that use text-based I/O. The application is created without a form, and therefore cannot receive windows messages. The application can, however, use the members of the Console class to interact with the user.

Debugging

Pocket PCs do not support the use of the Debug.Write and Debug.WriteLine methods for displaying debug output.

.NET Compact Framework-based applications are not able to send debug output to the Visual Studio .NET Output window, as the full .NET Framework does. Instead, debug output must be displayed in a local console window on the device.

Windows CE .NET provides support for a console window, and will therefore display debug output. Pocket PCs do not support a console window, so debug output is lost.

Note   For more information on debugging .NET Compact Framework-based applications, see .NET Compact Framework Debugging

Design Guidelines

Pocket PC

To insure consistency among Pocket PC applications, Microsoft has placed strict guidelines on the user interface and behavior of these applications. The details of these guidelines can be found in the Designed for Windows for Pocket PC Logo Guidelines.

These guidelines have strongly affected the behavior of the .NET Compact Framework when run on the Pocket PC.

Windows CE .NET

The wide variety of Windows CE devices makes providing a single set of guidelines impractical.

Conclusion

The .NET Compact Framework provides a rich development environment for both the Pocket PC and Windows CE. Differences in the individual platforms require that there be some slight variation in the behavior of the .NET Compact Framework classes. These variations allow developers to make the most of the host platform without the need to learn entirely different programming environments for each.

Show:
© 2015 Microsoft