In the opening chapter of The Windows CE Technology Tutorial
, author Chris Muench writes, "Developing applications and systems for Windows CE has a lot in common with the art of creating and taking care of bonsai trees." Like cultivators of bonsai trees, Windows CE programmers try to create compact versions of something larger, and frequently expend extra effort in the process. Muench then proceeds to illustrate the bonsai-like elegance and compactness of Windows CE code, while simultaneously showing how to pack handheld applications with loads of functionality.
Windows CE provides a strategy for choosing between eMbedded Visual C++ and eMbedded Visual Basic and then explains how to use each. The discussion of software development under Windows CE--both for desktop applications and those that lack graphical user interfaces--reflects a great deal of practical experience, and on more than one occasion references to undocumented aspects of Windows CE and its development tools are included. The book is careful to document potential pitfalls in certain palm-size PC hardware platforms. Throughout this book, the reader is guided through the development of an application called the Pocket-CD-Manager--which includes ActiveX Controls, database access via ActiveX Data Objects for Windows CE (ADO for CE), ActiveSync, bitmapping tricks, Winsock over IrDA, a help file, an installation script, and an assortment of other features useful for various production applications. It's an effective teaching strategy that turns a fine tutorial into an excellent one. --David Wall
Topics covered: Developing software for palm-size PCs that run Microsoft Windows CE. Development platforms, integrated development environments, simulators, and languages are all compared. The book discusses pretty much the entire Windows CE capability set, including Component Object Model (COM) for Windows CE, graphical user interface (GUI) design, connectivity via TCP/IP and IrDA, bitmaps, sounds, and installation routines. The tutorial also contains a lot of information on the Windows CE hardware specification and Microsoft's Windows CE logo requirements.
Welcome to the World of Windows CE
Windows CE is probably the most underestimated technology Microsoft has ever produced. At present, Windows CE is most commonly used in palm-size and handheld PCs, but in fact it is capable of much more. The embedded environment Windows CE is targeting holds a nearly unlimited reservoir of opportunities for software developers and original equipment manufacturers.
Windows CE was written from scratch but is modeled after its bigger brother Windows. This book will help you to understand the differences between these two brothers and will guide you step by step through all the major technologies of Windows CE.
Back in 1996, when Windows CE was still in diapers, I was already working on several hardware and software products using this program as the base technology. At that time I was working as a technology ambassador for Siemens at Microsoft, which entailed dual responsibilities: to evangelize Windows CE at Siemens and to deliver feedback from Siemens to Microsoft. During my time at Microsoft I made friends in all departments of the Windows CE team. The Microsoft DRG (Developer Relations Group) made sure that I always had the latest Windows CE devices running the newest beta build of their next generation software. The Windows CE Marketing and the Tools Team provided me with the latest versions of SDKs (Software Development Kits) and compilers. Many of those technologies were still in beta when I wrote this book. By the end of 1998 I had collected so much information and knowledge about Windows CE that I thought it would make a useful book for others.
How Is this Book Different from Others?
The title tells you that this book is a technology tutorial. But what is a technology tutorial? A tutorial explains something by walking the reader step by step through an example. This book is a technology tutorial because it uses the tutorial method to walk you through all the essential technologies of Windows CE. Traditional technology books generally discuss a technology in a more theoretical way, for example, by explaining the Application Programmable Interface (API) calls and their parameters. However, during my years of experience as a developer, I found that even the worst example is better than the best theoretical explanation.
During the course of this book you will find innumerable tiny examples and step-by-step explanations showing you how to recreate each example from scratch. At first the explanations will be very detailed, but as you proceed through the book, you'll find that they come to focus more on the essentials.
In addition, this book emphasizes the importance of Windows 2000. This new operating system will quickly become essential for developers, industrial users, and end-customers in the business sector.
The book also stresses the importance of the Common Object Model (COM) approach for Windows CE. COM is the best way of preparing any application for the digital and "distributed-technology" age we will face in the near future--and which I will discuss more fully in Chapter 12.
The "Thread Example": A Real-Life Application
Another big feature of this book is the "thread example." The thread example is a Pocket-CD-Manager (PCDM) application. It allows you to synchronize a database of your CDs with the "Microsoft Deluxe CD Player" on your desktop and manage it with your Windows CE device. The PCDM will, with very few exceptions, explore all the technologies of Windows CE. This example, which gets its name because it weaves through the book like a red thread, is a real-life application that you will create from scratch. At the end of the book the application will be ready for deployment, including a redistributable setup.
How to Read this Book
This book is meant for developers who want to bring their desktop programming experience to Windows CE but have not yet worked on Windows CE. In other words, it is aimed at Win32 professionals who are Windows CE beginners.
To guide you through the technologies of Windows CE, the book contains 12 chapters, each focusing on one area of Windows CE. The order of the chapters is determined by the real-life thread example. As in any tutorial, you will create this real-life example from start to finish. The sample application is a Pocket-CD-Manager that will synchronize a CD library database on your Windows CE device with the library of the Deluxe CD Player on your Windows 2000 desktop. To be more specific, you will learn how to Set up your development machine (Chapters 1-3) Create the first steps of the application by choosing the framework, creating the application base structures, and designing a prototype in eMbedded Visual Basic (Chapters 4-5) Create the framework for two components used in the sample application introducing COM on Windows CE (Chapter 6) Include the UI elements like CommandBar, CommandBand, and ListView, among others (Chapter 7) Add storage capacity to the application using Registry, ObjectStore, and Active Data Objects (ADO) (Chapter 8) Add support for remote technologies like Remote Application Programmable Interface (RAPI), infrared communication, and ActiveSync (Chapter 9) Create a fancy About Box using graphic APIs on Windows CE (Chapter 10) Wrap up the application by adding advanced feature support for palm-size PCs, creating a setup to install the application on Windows CE and to distribute it using the Windows Installer Technology (MSI) (Chapter 11)
If you follow all the steps, you will end up with a fully functional Pocket-CD-Manager application.
One goal of this book is to keep the sample code as simple as possible. Therefore you will not check each and every error condition, and some code will look a bit "crude." For example, instead of using dynamically allocated and growing lists, the book will rely upon fixed-dimension arrays.
Besides the thread example, each chapter will also contain a tiny code snippet that shows the technology at work. This will allow you to jump to any chapter if you are just interested in a specific technology.
To summarize, the technology section of each chapter will have several sub-sections including all or parts of the following: An introduction to the technology A small code snippet giving you a quick glance at the technology A sub-section wrapping the technology into a COM component A small Visual Basic code snippet using the COM component of the previous sub-section A sub-section adding the COM component to the main PCDM application A summary highlighting the main caveats, gotchas, and remarkable facts of the technology
The book contains countless examples and sample code. To save space, I provide only the technology-specific code and not all the plumbing code that the eMbedded Visual C++ (eVC) wizards create. If you have to change any code, the new code will be printed in boldface. Most of the code is embedded in step-by-step procedures that explain exactly what you have to do to add the code to the example. Since many of those procedures will have repeated content (for example, adding a method to a COM component), they will become progressively simpler and less detailed as the book progresses. // Code lines themselves are printed in fixed letter spaces. The Companion CD
All source code printed in the book can also be found on the companion CD in the directory Sources. Chapter and section numbers structure this directory. An extra sub-directory contains the sources of the thread example. Inside this directory you will find sub-directories named PCDMUI, for the user interface component; PCDMDLL, containing the core technology component; and PCDM CE, the main thread-example application.
Other directories include tools, helpers, and some redistributables you can use to evaluate certain third-party technologies like DeviceCOM, InstallShield for CE, the Microsoft Installer SDK, and the latest ActiveSync. The source code on the CD was created using the latest Microsoft eMbedded Visual Tools. I removed all temporary eVC files but kept the executables and DLLs so that you can run the application without having to recompile them. If you open the source-code, you will find the book-specific code between two remark lines: // **************************************
The thread-example code adds the step number after the chapter number to the remark tag. If you are familiar with Extended Markup Language (XML), you will recognize that we are using XML syntax to mark the code of the book. Using a Visual Basic macro, you could highlight the areas where the book has added code. The Beginning at the End
The final chapter will give you some general ideas about where to go from here and what the digital future may bring. In case you do not know what to do with Windows CE, just read it, and you should come away with at least one idea that leads to a great digital-age product.
Now, without further ado, let's get started.