HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This is the first complete Windows developer's guide to leveraging the power of Windows CE 3.0 and future "Windows-powered" devices. Leading Windows CE developer Chris Muench teaches Windows developers all they need to know to build CE 3.0 applications fast. Start by setting up and mastering the Windows CE 3.0 "Rapier" development environment; then, walk step-by-step through building a robust CE application that utilizes COM components, integrates with Windows 2000 and other Windows desktops, and even provides Internet connectivity. Along the way, developers will learn how to design CE user interfaces, support printing, storage, and remote access; synchronize with desktops via the latest version of ActiveSync; incorporate graphics and audio; even integrate with Pocket Outlook.
Preface.
Acknowledgments.
Foreword.
I. READY…SET…GO!
1. Why Windows CE?What Is Windows CE?
Windows CE versus Embedded Windows NT.
2. Preparing Your PC for Windows CE.Choosing the Right PC.
Get at Least a Pentium II or K6-2 with 300MHz.
Use Windows 2000 Professional or Windows 2000 Server.
Get a Lot of RAM.
Use the New Dual-or Multi-Monitor Support.
Get a Big Hard Disk.
Use a Network Interface Card (NIC).
Use DVD-ROM Instead of CD-ROM.
Choosing the Right Windows CE Device.
Summary.
3. Installing Your PC.Installing the Operating System.
Installing the Development Tools.
Office 2000.
Visual Studio 98.
The eMbedded Visual Tools 3.0.
The Windows CE Platform SDKs.
ActiveSync 3.1.
Setting Up Your Windows CE Device to Connect to the Workstation.
Create a Direct Dial-Up Connection Using 115K Baud.
Setting the Default Connection for the PC-Link.
Test Your Connection to the PC.
Optional Steps: Using a LAN Card to Connect to Your PC.
4. The Windows CE Development Tools.Windows CE Tools.
Remote File Viewer.
Remote Heap Walker.
Remote Process Viewer.
Remote Registry Editor.
Remote Spy++.
Remote Zoomin.
The Control Manager.
eMbedded Visual C++ versus eMbedded Visual Basic.
The eMbedded Visual Basic Environment.
Creating, Downloading, and Debugging a Small eVB Application.
The eMbedded Visual C++ Environment.
Creating, Downloading, and Debugging a Small C++ Application.
Using the Windows CE Platform Manager.
Choosing the Right Framework for Your Task.
Basic Windows CE Development Tips.
Compile-Time Version Checking.
Compile-Time Platform Detecting.
Runtime Version Checking.
Accessing Debug Messages in ActiveX Controls.
Debugging ActiveX Controls.
5. The Thread-Example Pocket-CD-Manager.The Pocket-CD-Manager Feature List.
Creating the Framework of Your Application.
Differences between the Desktop and Windows CE Versions.
stdafx.h.
PCDM.CPP.
Mainfrm.cpp.
PCDMoc.cpp.
PCDMView.cpp.
Resources.
Differences in Project Settings.
The User Interface of the Pocket-CD-Manager.
''File''.Creating a Prototype of PCDM.
Creating the Desktop Version of the Prototype.
Porting the Desktop Prototype to Windows CE.
Preparing the DeluxeCD Database.
Converting the Desktop eVB Project to an eVB Project.
Migrating Forms and Code.
Migrating ADO Desktop to ADO for Windows CE.
Summary.
6. COM for Windows CE.A Short Introduction to COM.
How Does COM Work?
Versioning.
Early Binding No Longer Necessary.
Communicating EXE to EXE.
Making Remote Communication Seamless.
COM Activation Methods.
In-Place Activation.
ActiveX Controls.
Inproc: In-Process Activation.
EXE to EXE.
MTS or DLLHOST.EXE.
DCOM.
COM+ Services.
Creating a Small COM Server.
Creating a COM Server for Windows CE.
Generating the Desktop-Equivalent COM Server.
Calling the COM Server in C++.
Using #import.
Calling the COM Server in Visual Basic.
Creating an ActiveX Control.
Creating an ActiveX Control for Windows CE.
Generating the Desktop Equivalent.
Using the Control in eMbedded Visual C++.
Using the Control in eMbedded Visual Basic.
Creating the Wrapper Controls for the PCDM.
DCOM: Distributed COM.
deviceCOM: The Industrial Version of DCOM.
Installation of deviceCOM.
Starting DCServer as a COM Surrogate.
A Small deviceCOM Example.
Other Features of deviceCOM.
Summary.
II. WINDOWS CE IN DETAIL.
7. The Windows CE User Interface.The Command Bar.
Adding a Command Bar to an Application.
PCDMUI: Including the Command Bar.
Testing the Control in eMbedded Visual Basic.
Calling the Control from the PCDM Application.
Summary.
The Command-Band.
Adding the Command-Band to an Application.
Updating the PCDMCommander Class.
Testing the New PCDMCommander Class in eMbedded Visual Basic.
Using the PCDMCommander Class in the PCDM Application.
Summary.
Special Palm-size PC Considerations.
Small Example Showing the Application Menu Bar.
Updating Your PCDMCommander Class.
Testing the New Class in eMbedded Visual Basic for Palm-size PC 2.0.
Verifying Your PCDM Application.
The List View Control.
Including the List View Control in an Application.
Adding the List View Control to PCDMUI.DLL.
Testing the New CPCDMList Class in Visual Basic.
Using the New CPCDMList Class in the PCDM Application.
Summary.
Other Supported Common Controls.
Common Controls That Are Not Supported.
Printing in Windows CE.
The Hardware Buttons on Palm-size PCs.
The Action and Escape Keys.
The Application Launch Keys.
The Soft Input Panel.
A Simple Application Showing the SIP.
ShowSIP() for PCDMDLL.DLL.
Testing the New PCDMUI in Visual Basic.
Ink Control.
Creating a Small Ink Control Application.
Other Ink Control Functions.
8. Storage.The Windows CE Registry.
Adding CPCDMAccessReg to the PCDMDLL.DLL.
Testing the New CPCDMAccessReg in eMbedded Visual Basic.
The File System.
No Drive Letters.
The Name ''Storage Card'' Can Be Localized.
''My Documents'' on a Palm-size PC.The Object Store.
A Simple API Application Accessing the Object Store.
A Simple MFC Application Accessing the Object Store.
Adding Object Store Access to the PCDMDLL.DLL.
Testing the New Class in eMbedded Visual Basic.
Adding the PCDMAccessDB Class to the PCDM Application.
ADO for Windows CE.
A Simple Application Using ADO.
Adding ADO to the PCDMAccessDB Class.
Retesting ADO Changes in eMbedded Visual Basic.
Pocket-Access Files.
Copying an Access 2000 Database to the Emulation.
Synchronizing Pocket-Access with Access 2000 Databases.
Updating the PCDM to Use the New Database.
9. Remote and Connectivity.Using RAS as TCP/IP Provider.
Install the Communication Cable between Two PCs.
Setting the Baud Rate of the Communication Cable to 115K.
Set Up Windows 2000 Incoming Connections.
Windows 2000 Server in a Domain Environment.
Remote API.
A Small RAPI Example.
Converting ObjectStoreIt to a Desktop Application.
Updating Your PCDM Application with RAPI.
Testing the Class in Visual Basic for the Desktop.
ActiveSync: Keep in Sync with Your Data.
The Concept of ActiveSync.
Creating an ActiveSync Service Provider for the PCDM.
Some Debugging Tips.
Summary.
Distributed COM.
Winsock.
A Tiny Winsock Example.
The PCDM Application.
IrDA or Infrared: The Wireless Wire.
Adding IrDA Support to Your Winsock Example.
Adding IrDA Support to the PCDMDLL.
Test the New PCDMDLL in eMbedded Visual Basic.
Implementing @BHEADS = Send to...''/
Receive...''in the PCDM Application.
HTTP: Integration of the Internet.
Wininet: The Client Internet API.
A Small Wininet Example.
The Web Server Issue.
10. Graphics and Sounds.Loading Bitmaps.
Using LoadBitmap().
Using SHLoadDiBitmap().
Using Custom Code.
Adding a Picture Class to the PCDMUI.DLL.
Displaying Bitmaps Using GDI.
Updating OnDraw of the PCDMPicture Class.
Testing the PCDMPicture Class in eMbedded Visual Basic.
Updating the PCDM Application.
Playing Sounds Using the Windows CE API.
Adding a Sound to the PCDM Application.
DirectX on Windows CE.
11. Miscellaneous Topics.Enhancements for Pocket PC Devices.
Window Size Must Be Calculated Differently.
Only Full-Screen Dialog Boxes.
A Tiny Example.
Summary.
Creating Help Files for Your Application.
Creating a Help File for the PCDM Application.
Calling the Help File from within the PCDM Application.
Creating a Control Panel Application.
Adding an Icon to the Taskbar.
Adding a Task-bar Icon to Your PCDM Application.
Installation for Windows CE.
Installation Targeting Windows CE.
The Installer Information File (.INF).
Creating the Installer File for Your PCDM Application.
Creating a CEF Installation for PCDM.
Writing a Custom SetupDLL.
CF-Card Instant-Installer for the Pocket PC.
Creating an Installation for the Desktop.
Rules to Make Your App Logo-Compliant.
Logo Requirements of All Target Platforms.
Special H/PC Logo Requirements.
Special Palm-size PC Requirements.
12. Conclusions and Visions.A Word about Your PCDM Application.
What's Next?
How Small Will It Become?
The Dark Side of the New World.
What Can You Do to Take Part?
Where Is the Technology Now?
III. Appendices.
Appendix A. Frequently Asked Questions.
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.
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.
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.
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
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:
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.
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 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.