Microsoft has been investing in mobility for over a decade. This investment began in 1992 with two projects code-named Pulsar and WinPad. The WinPad project was initially designed to produce a handheld PC (then termed a "PC Companion") to compete with Apple's Newton MessagePad (which itself eventually failed to catch on) based on Windows 3.1, while the Pulsar project was aimed more at pager-like devices using an object-oriented operating system. However, due to internal struggles as to the feature sets to support and hardware issues, these projects ultimately failed to produce viable products. However, shortly thereafter in 1994, these projects were reorganized under the code name Pegasus, which eventually led to the release in 1996 of Microsoft's first operating system designed for mobile devices, Windows CE.
Although you might think that the CE in Windows CE stands for "Compact Edition," Microsoft insists that CE is not an acronym, but simply the name of the operating system. Microsoft now refers to devices running Windows CE as simply "Windows-powered devices."
Since the release of Windows CE, Microsoft has continued to invest in operating systems, platforms, and development tools for mobility. In this section we'll explore those three concepts in order to put the Compact Framework in context. Note that these concepts are naturally hierarchical with operating systems at the highest level and development tools at the lowest.
The operating systems that Microsoft has developed in this space can be differentiated between the various versions of Windows CE and embedded operating systems used in specialized devices, ranging from Internet appliances to manufacturing equipment.
Windows CE itself is based on its desktop cousins and, as such, supports an API familiar to Windows developers. As a result, while it is relatively straightforward for developers accustomed to developing desktop applications to move to Windows CE development, there are still considerations that developers must take into account when developing for smaller devices, including the user interface (UI), power consumption, limited storage, and communication options.
In general, the design of Windows CE adhered to the following design principles:
Small memory footprint
The modular approach allows Windows CE to be broken into about 300 modules (in the latest Windows CE .NET release) from which an OEM can choose to build an operating system. The smallest of these systems can fit in about 200K of RAM, while a typical configuration that includes the graphical interface and applications is about 4MB.
A diagram that illustrates the architecture of Windows CE is shown in Figure 1-2.
As previously mentioned, Windows CE 1.0 was launched in 1996 and was targeted for handheld PDAs (referred to as Handheld PCs or H/PCs) that had small touch-type keyboards, grayscale displays at 480 x 240 resolution, and alkaline batteries. These devices were manufactured by a variety of vendors, including Casio (Cassiopeia A10), Compaq (Companion C120), HP (320LX), and Phillips (Velo I), among others. They supported synchronization of e-mail and calendaring with Schedule+ and Outlook using a serial connection, as well as expandability via PCMCIA or PC card slots.
 One of the authors of this book fondly remembers the day he bought his Cassiopeia A10 and joined the world of mobile computing. The device served him well for about two years, until he inadvertently left it on top of his car while backing out of the driveway. Needless to say, the device was not "ruggedized" and, even if it had been, would likely not have survived the 30 MPH impact with the curb. Such are the dangers of mobile computing.
Support for demand-paging of code, ActiveX, WinInet API, cascading menus, Ethernet networking, true-type fonts, and x86 processors
Support for USB, NTLM authentication, cryptography APIs, color displays
Support for Component Object Model (COM) and Microsoft Message Queue (MSMQ), smartcard support, embedded Web server with ASP support
CE .NET 4.0
Automatic configuration of 802.11 networks, BlueTooth, customizable UI elements, Direct3D, DirectMusic APIs, event-based notifications, Kerberos, and many others
CE .NET 4.1
Support for IPv6, file viewers, and additional performance
CE .NET 4.2
Enhanced real-time processing, better performance, enhanced multimedia capabilities, support for IPSec
Since 1996 Microsoft has continued to enhance the Windows CE operating system. Table 1-1 briefly describes the timing and features of the major releases.
Windows CE was designed to support lower-power CPU architectures that are more suited for mobile devices. These include Advanced RISC Machines (ARM), Microprocessor without Interlocked Pipeline Storage (MIPS), PowerPC (another RISC processor), XScale (from Intel), and SuperH (SH) from Hitachi, another RISC architecture). With each release of Windows CE, the number of supported processors from various vendors such as ARM, NEC, Toshiba, Hitachi, and Intel has increased, with the notable exception that Windows CE .NET does not support any PowerPC processors.
All of the Windows CE versions also ship with productivity and supporting software, including Pocket Office (Pocket Word, Pocket Excel, and later Pocket PowerPoint and Pocket Access), Pocket Outlook, Schedule+ (in CE 1.0), Pocket Explorer, and synchronization software that in its first incarnation was called Handheld PC Explorer and later ActiveSync 3.1 and 3.5. The Pocket PC can also run a version of Windows Media Player and Microsoft Reader, in addition to other software you can download from www.microsoft.com/mobile/pocketpc/downloads/default.asp.
Although Microsoft eventually released Windows CE, work continued on a scaled-down version of a Windows operating system that could be embedded in specialized devices, such as set-top boxes, kiosks, retail point-of-sale (POS) systems, Internet appliances, and manufacturing equipment. These efforts eventually led to two embedded operating systems, Windows NT Embedded 4.0 in 2000 and Windows XP Embedded in 2002. Essentially, these are modularized versions of the desktop operating systems.
Typically, OEMs would choose an embedded operating system when careful power management and a footprint of under 5MB are not required, when using an x86 architecture, when support for existing Win32 applications is required, and when extensive networking and communications support is required. For example, OEMs can use the Windows Embedded Studio tool to build a platform based on Windows XP Embedded by choosing from the available modules or using a set of predefined templates, including three for set-top boxes, a home gateway, kiosk, gaming console, network-attached storage (NAS), POS, and information appliances.
In addition, Microsoft offers a Server Appliance Kit (SAK) for Windows 2000 designed to help OEMs design server appliances such as Web servers, NAS devices, and other customer appliances.
Microsoft usually uses the term "embedded" to refer to both Windows CE .NET and Windows XP Embedded and, therefore, provides information on its Web site for both at www.microsoft.com/windows/embedded.
At this time the Compact Framework does not support developing software on either of the embedded operating systems from Microsoft.
It's important to keep in mind the distinction between the operating systems discussed in the previous section and what Microsoft refers to as "platforms." Essentially, a platform is defined by the combination of a specific set of hardware, a set of programs, modules, UI components, and an operating system. A platform defines all the key characteristics of a class of devices in a single package, so that software developers and device manufacturers can more easily target their solutions.
For example, in the case of the Pocket PC platform, Microsoft defined the hardware specifications that vendors such as Compaq and HP implemented. The platform included the Windows CE 3.0 operating system in addition to extensions such as the Pocket PC shell and Notification API. For software developers, all of these APIs are packaged into a platform SDK available on Microsoft's Web site. Table 1-2 shows some of the platforms based on Windows CE.
CE 1.0, 2.0
Code-named "Mercury." The original H/PC devices such as the Cassiopeia A10 with 2MB to 8MB of RAM.
Handheld PC Professional
CE 2.11, 3.0
Originally introduced in 1998 and reissued as Handheld PC 2000 in 2000. Used primarily in larger keyboard-based devices (10" x 8") with 16MB or 32MB of RAM and a wide variety of specifications. Includes Pocket Access. Examples include HP Jornada 720 and Intermec 6651. These come in half-screen (code-named "Callisto") and full-screen (code-named "Jupiter") devices.
CE 2.0, 3.0
Code-named "Apollo" and first available in 1998. Since then, the Auto PC has been replaced by the Windows CE for Automotive[*] platform for telematics and the more expansive "Car .NET" initiative.
Palm-Size PC (P/PC)
CE 2.1, 2.11
Code-named "Gryphon," available in 1998, and included devices such as the Compaq Aero. Designed for monochrome devices at 320 x 240 with 2MB to 16MB of RAM. These devices were quickly made obsolete by the Pocket PC platform.
Pocket PC 2000
Code-named "Rapier" and abbreviated PPC. This platform was based on an early version of CE 3.0. The Compaq iPAQ is the most popular device on this platform that can be thought of as a superset of the Palm-Size PC platform with similar specifications but with faster processors and more memory and battery life. These devices use a variety of processors with 32MB of RAM. Devices that support FlashROM, such as the Compaq iPAQ, can be upgraded to Pocket PC 2002 because they support FlashROM.
Pocket PC 2002
Code-named "Merlin" and built on the fully released CE 3.0. Must use the Intel StrongARM (or compatible processor such as the Intel X-Scale) with 32MB or 64MB of RAM. Must also include 32MB FlashROM for system software and must support upgrades and use a hybrid transflective thin film transistor (TFT) screen. The Pocket PC 2002 Phone Edition (code-named "Space Needle") is a special version of this platform. The Intermec 700 and Compaq iPaq support this platform.
Pocket PC 2003
Code-named "Peregrine" and will include devices with a square screen and a keyboard and some with a portrait screen and no keyboard. Not yet released at the time of this writing.
Released in late 2002 and code-named "Stinger." Targeted at phones also supporting traditional PDA features, including color screens, synchronization, local storage, and applications. The first announced device was the Orange SPV in October 2002.
Superset of Windows XP called Windows XP Professional Tablet PC Edition
Device available Fall 2002. Portrait-based, keyboardless device with high-resolution displays, voice, handwriting recognition, and 802.11 networking
Smart Display Monitor
CE .NET 4.1
Code-named "Mira" and includes display devices targeted for home users that enable them to view their Windows XP Professional PC from elsewhere in the home using 802.11 technology.
[*] See www.microsoft.com/automotive/ for more information on Windows CE Automotive version 3.5 and Car .NET.
Color LCD displays come in two types, active and passive. Active displays such as thin film transistor (TFT) offer a sharper image by refreshing the screen more frequently than passive displays, although newer, passive technologies, such as color super-twisted nematic (CSTN) developed by Sharp, are similar to active displays but are half the cost.
LCDs also support two types of lighting, transmissive and reflective. Reflective screens use much less power because they use external light, such as light around the device or a front-lighting system, but are darker when viewed indoors. Transmissive lighting provides backlighting from a light source behind the screen, but this causes the display to be unreadable outdoors.
It should also be noted that both Windows CE 3.0 and Windows CE .NET also include a platform builder that allows vendors to adapt Windows CE to their hardware. Whether adapting their hardware to an existing platform, such as Pocket PC 2002 (by, for example, mapping buttons on the device to functions in the operating system), or building an entirely new platform for an embedded system, OEMs can use the tools to build a modularized Windows CE operating system by choosing from the 300 modules in Windows CE .NET. Using the platform builder (and the associated wizards), OEMs can define which processors the system supports and choose which of the components to include, in addition to providing low-level tools to manage the interaction of Windows CE with the targeted hardware. However, because the platform builder is not meant to be used by application developers developing business applications, it is not covered here.
At the lowest level, Microsoft provides different development tools for software developers to use on the various platforms. These include the following:
eMbedded Visual C++ 3.0 (eVC++): This version of Visual C++ allows for development on all Windows CE devices including embedded devices. Its primary advantages are a small footprint and speed, and it is therefore recommended when developing system-level components such as device drivers, ActiveX controls, games, and dynamic link libraries (DLLs). In addition, eVC++ is for now the only supported development environment for the SmartPhone SDK.
eMbedded Visual C++ 4.0: This version can be used to develop solutions on Windows CE .NET only and is used in the same basic scenarios as mentioned earlier, namely those where performance and a small footprint are paramount in importance. Both eMbedded Visual C++ 3.0 and 4.0 produce native code (code not managed by the common language runtime).
eMbedded Visual Basic 3.0 (eVB): A subset of the VB development environment that has been widely adopted for application development on the Pocket PC, this version has some limitations when compared with Visual C++ in terms of functionality and performance (all eVB code is interpreted rather than natively compiled for the device), but it is a high-productivity environment targeted at business developers. Its runtime must be installed on the device, although its larger size (more than 500K for the VB runtime and COM engine) precludes its inclusion by most OEMs on embedded devices. In all, over 150,000 developers have downloaded the free eMbedded Visual Tools, most of whom use eVB. Among its key limitations, however, are eVB's untyped nature (everything is a variant) and lack of support for object-oriented development. eVB will also no longer be updated, and so the natural path for eVB developers is to use VB .NET and the Compact Framework.
Microsoft Windows .NET Compact Framework with SDP for Visual Studio .NET: The focus of this book, this version shipped with Visual Studio .NET (VS .NET) 2003. It targets Pocket PC 2000, 2002, and embedded Windows CE .NET 4.1 platforms and produces managed code using either a subset of VB .NET (VB .NET or simply VB from here on) or Visual C# .NET that is executed by the common language runtime, analogous to the desktop Framework. The Compact Framework and SDP are designed to bring mobile development to the core set of Framework developers by providing a modern and robust development environment and set of tools.
Most code written on the Compact Framework will execute on the Pocket PC Phone Edition. However, the Compact Framework does not officially support the platform because the emulator that ships with the Compact Framework and SDP does not support the GPRS connectivity APIs, and no class libraries ship with the Compact Framework to use the APIs. To access these APIs, Compact Framework developers can call the APIs directly when the code is running on the device, using a technique called PInvoke, covered elsewhere in this book. Look for more support in a future release of the Compact Framework and SDP.
Microsoft ASP.NET Mobile Controls (formerly MMIT): This also uses VS .NET, but it is a server-side technology targeting mobile devices using a Web interface and different markup languages, including HTML, WML, cHTML, and XHTML. The following sections discuss Mobile Controls in greater detail.
 Supported in Device Update 2 for VS .NET 2002 and included in the released version of VS .NET 2003.
This rich history of development support for mobile devices puts Microsoft in a strong position with managers and developers choosing a platform on which to build their mobile applications.