Chapter 38 -- Visual C for Windows CE

Chapter 38

In early 1997, Microsoft released a new version of the Windows family of operating systems named Windows CE. Original equipment managers (OEMs) are the target audience for Windows CE. OEMs create small, portable devices—such as hand-held computers—and embedded systems. A myriad of different operating systems, a lack of strong development tools, and a maze of user interfaces have plagued both the portable-device and embedded system markets. In the past, these problems limited the use of these systems and restricted the availability of inexpensive software applications.

At the time of this writing, Windows CE support for Visual C++ 6.0 was not available. All screen shots and samples programs in this chapter were created using Visual C++ for Windows CE 5.0.

Microsoft hopes that Windows CE can do for the embedded and handheld markets what Windows did for the desktop PC industry. Based on the target audience, you can probably guess that Windows CE has different design goals than Windows 98 and Windows NT. One goal was modularity: if an OEM is using Windows CE in an embedded device for a refrigerator, the keyboard and graphics output modules are not required. The OEM does not pay a penalty for modules not used by the application of Windows CE.

To date, there have been two major releases of Windows CE. The first release was primarily for Handheld PCs (H/PCs) and was limited to noncolor applications. Windows CE 1.0 lacked many advanced Win32 features such as COM and ActiveX, large chunks of GDI, and many Windows controls. Win- dows CE 2.0 was released in late 1997 and added support for a variety of new device types, color, COM and ActiveX technology, and also a Java virtual machine.

Before we look at the details of the Win32 support in Windows CE, let's examine some of the existing device types to get a feel for possible Windows CE applications.

Windows CE devices

Currently the best known Windows CE devices are the H/PCs such as those available from HP, Sharp, Casio and a variety of vendors. Figure 38-1 shows a typical H/PC machine.

Figure 38-1. A typical Handheld PC.

H/PCs currently have display resolutions anywhere from 480 by 240 pixels to as large as 640by 240 pixels. They typically have a keyboard, infrared port, serial port, and microphone. The standard software on these devices includes: Pocket Word, Pocket Excel, Internet Explorer, Outlook Express, and other scaled-down Microsoft productivity applications.

A smaller device called a Palm-size PC (P/PC) shown in Figure 38-2 is completely pen-based and does not have a keyboard. Screen sizes are also smaller (240 by 320 pixels) and only gray-scale displays are currently available for P/PCs.

Figure 38-2. A Palm-size PC.

Note: At the time of this book's publication, MFC is not supported on the Palm-size PC platform. The SDK for Palm-size PCs and embedded development is also not included with the Visual C++ for Windows CE product. These SDKs must be downloaded from the Microsoft website http://www.microsoft.com.

Perhaps the most exciting Windows CE devices now reaching the market are embedded applications. For example, the CD player from Clarion shown in Figure 38-3 features a GUI, voice recognition, cellular phone support, and a variety of other features that are changing the way we think about electronic devices and appliances. Unlike Windows 95, which only supports Intel processors, and Windows NT, which only supports the Intel and Alpha processors, Windows CE supports a myriad of embeddable 32-bit processors such as the MIPS chip, Hitachi chips, and a variety of other chip sets. This flexibility dramatically increases the potential reach of Windows CE in the embedded market.

Figure 38-3. An automotive CD player powered by Window CE.

Because all of these devices are based on Windows CE, you can write applications for them using a subset of the familiar Win32 APIs that you have learned throughout this book. Before we investigate Visual C++ programming for Windows CE, let's take a look at the subset of Win32 implemented by Windows CE.

Windows CE vs. Windows 98 and Windows NT

Each Windows CE platform (H/PC, Palm-size PC and embedded) supports various subsets of the Win32 API based on which Windows CE modules are loaded. The "core" functionality is fairly static among devices—GDI, windows, and controls and so on, but some user input functions are different. (On a Palm-size PC, for example, it doesn't make sense to have keyboard functions.)

The Win32 support in Windows CE matches the primary design goal of Windows CE: keep everything as small as possible. Whenever a duplicate Win32 call exists, Windows CE provides only the most general API function. For example, instead of implementing both TextOut and ExtTextOut, Windows CE supports only the more flexible ExtTextOut, because in this single API you have the functionality of both.

Another interesting aspect of the Win32 Windows CE implementation is that only Unicode functions and strings are supported. You need to be sure to wrap your Windows CE MFC strings with the _T macro.

At the GDI layer, Windows CE supports a relatively small subset of the implementations found in Windows 95, Windows 98, and Windows NT. The key groups of GDI Win32 API functions not implemented in Windows CE are mapping modes, arcs, chords, metafiles, and Bézier curves. When you draw lines, you must use PolyLine because MoveTo and LineTo are not supported. Cursor and mouse handling in Windows CE can also be different from what you are accustomed to on larger systems.

Version 2.0 of Windows CE adds many key features that allow for parity with its big brothers, such as color support, TrueType font support, printing, and memory DCs. Many other nuances of the various GDI implementations are well documented in the Windows CE SDK, which is shipped as part of the Visual C++ for Windows CE product.

Windows CE also has some major differences in windowing. Perhaps the largest difference is the fact that only SDI applications are supported. Thus, porting existing MDI applications to Windows CE is relatively difficult. Another interesting windowing fact is that Windows CE windows are not resizable. Since there are a wide variety of screen resolutions, you should programmatically size windows based on the resolution of the display, instead of using static layouts.

Most of the standard Windows 95, Windows 98, and Internet Explorer 4.0 common controls are available on Windows CE, except for the following: the rich edit control, the IP control, ComboBoxEx controls, and the hot key control. Windows CE actually introduces a new common control—the command bar. Command bars implement a hybrid menu bar and toolbar that occupies considerably less space than the standard menu bar and toolbar configuration found in most desktop applications. Figure 38-4 shows an example of a Windows CE command bar.

click to view at full size.

Figure 38-4. A Windows CE command bar.

ActiveX and COM are supported in Windows CE 2.0, but only for in-process COM objects such as ActiveX controls. Multithreading, memory management, exception handling, and most other areas of Win32 are fully supported —with a few caveats—by Windows CE.

Now that you're familiar with the basics of Windows CE, let's take a look at the Visual C++ development environment for this new operating system.



Programming Visual C++
Advanced 3ds max 5 Modeling & Animating
ISBN: 1572318570
EAN: 2147483647
Year: 1997
Pages: 331
Authors: Boris Kulagin

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net