| Acknowledgments | xix |
| Introduction | xxi |
| PART I WINDOWS PROGRAMMING BASICS | |
| 1 Hello Windows CE | 3 |
| What Is Different About Windows CE | 3 |
| Fewer Resources in Windows CE Devices | 4 |
| Unicode | 4 |
| New Controls | 5 |
| Componentization | 5 |
| Win32 Subset | 6 |
| It's Still Windows Programming | 6 |
| Hungarian Notation | 6 |
| Your First Windows CE Application | 7 |
| Building Your First Application | 10 |
| Running the Program | 11 |
| What's Wrong? | 11 |
| Hello2 | 12 |
| Anatomy of a Windows-Based Application | 15 |
| The Window Class | 15 |
| The Window Procedure | 15 |
| The Life of a Message | 16 |
| Hello3 | 17 |
| Registering the Window Class | 20 |
| Creating the Window | 22 |
| The Message Loop | 23 |
| The Window Procedure | 24 |
| HelloCE | 28 |
| The Code | 29 |
| Running HelloCE | 36 |
| 2 Drawing on the Screen | 39 |
| Painting Basics | 40 |
| Valid and Invalid Regions | 40 |
| Device Contexts | 41 |
| Writing Text | 43 |
| Device Context Attributes | 44 |
| The TextDemo Example Program | 46 |
| Fonts | 52 |
| The FontList Example Program | 58 |
| Bitmaps | 66 |
| Device-Dependent Bitmaps | 67 |
| Device-Independent Bitmaps | 68 |
| DIB Sections | 68 |
| Drawing Bitmaps | 71 |
| Lines and Shapes | 74 |
| Lines | 74 |
| Shapes | 77 |
| Fill Functions | 80 |
| The Shapes Example Program | 82 |
| 3 Input: Keyboard, Mouse, and Touch Screen | 91 |
| The Keyboard | 91 |
| Input Focus | 92 |
| Keyboard Messages | 92 |
| Keyboard Functions | 98 |
| The KeyTrac Example Program | 100 |
| The Mouse and the Touch Screen | 109 |
| Mouse Messages | 109 |
| Working with the Touch Screen | 110 |
| The TicTac1 Example Program | 118 |
| 4 Windows, Controls, and Menus | 129 |
| Child Windows | 129 |
| Window Management Functions | 130 |
| Enumerating Windows | 131 |
| Finding a Window | 131 |
| Editing the Window Structure Values | 132 |
| Windows Controls | 135 |
| Button Controls | 137 |
| The Edit Control | 140 |
| The List Box Control | 141 |
| The Combo Box Control | 141 |
| Static Controls | 142 |
| The Scroll Bar Control | 143 |
| The CtlView Example Program | 147 |
| Menus | 179 |
| Handling Menu Commands | 181 |
| Resources | 181 |
| Resource Scripts | 182 |
| Icons | 184 |
| Accelerators | 185 |
| Bitmaps | 186 |
| Strings | 186 |
| The DOIView Example Program | 187 |
| 5 Common Controls and Windows CE | 205 |
| Programming Common Controls | 206 |
| The Common Controls | 208 |
| The Command Bar | 209 |
| The CmdBar Example | 221 |
| Command Bands | 236 |
| The CmdBand Example | 246 |
| The Menu Bar | 260 |
| The MenuBar Example | 269 |
| The Month Calendar Control | 286 |
| The Date and Time Picker Control | 289 |
| The List View Control | 292 |
| The CapEdit Control | 294 |
| Other Common Controls | 295 |
| Unsupported Common Controls | 296 |
| 6 Dialog Boxes and Property Sheets | 297 |
| Dialog Boxes | 298 |
| Dialog Box Resource Templates | 298 |
| Creating a Dialog Box | 302 |
| Dialog Box Procedures | 303 |
| Modeless Dialog Boxes | 307 |
| Property Sheets | 308 |
| Common Dialogs | 314 |
| The DlgDemo Example Program | 316 |
| PART II WINDOWS CE PROGRAMMING | |
| 7 Memory Management | 357 |
| Memory Basics | 357 |
| About RAM | 358 |
| About ROM | 358 |
| About Virtual Memory | 359 |
| An Application's Address Space | 362 |
| The Different Kinds of Memory Allocation | 364 |
| Virtual Memory | 365 |
| Heaps | 371 |
| The Local Heap | 372 |
| Separate Heaps | 373 |
| The Stack | 375 |
| Static Data | 376 |
| String Resources | 379 |
| Selecting the Proper Memory Type | 379 |
| Managing Low-Memory Conditions | 380 |
| 8 Files and the Registry | 385 |
| The Windows CE File System | 386 |
| The Object Store vs. Other Storage Media | 387 |
| Standard File I/O | 387 |
| The FileView Sample Program | 396 |
| Memory-Mapped Files and Objects | 406 |
| Navigating the File System | 408 |
| The Registry | 415 |
| Registry Organization | 416 |
| The Registry API | 417 |
| The RegView Example Program | 421 |
| 9 Windows CE Databases | 439 |
| Databases | 439 |
| Basic Definitions | 439 |
| The Database API | 441 |
| The AlbumDB Example Program | 458 |
| 10 Modules, Processes, and Threads | 489 |
| Modules | 489 |
| Processes | 493 |
| Creating a Process | 494 |
| Terminating a Process | 497 |
| Other Processes | 498 |
| Threads | 499 |
| The System Scheduler | 499 |
| Creating a Thread | 502 |
| Setting and Querying Thread Priority | 504 |
| Setting a Thread's Time Quantum | 506 |
| Suspending and Resuming a Thread | 506 |
| Fibers | 507 |
| Thread Local Storage | 509 |
| Synchronization | 511 |
| Events | 512 |
| Waiting... | 514 |
| Semaphores | 518 |
| Mutexes | 520 |
| Duplicating Synchronization Handles | 521 |
| Critical Sections | 521 |
| Interlocked Variable Access | 523 |
| Windows CE Security | 525 |
| Interprocess Communication | 527 |
| Finding Other Processes | 527 |
| WM_COPYDATA | 528 |
| Named Memory-Mapped Objects | 529 |
| Message Queues | 531 |
| Communicating with Files and Databases | 534 |
| The XTalk Example Program | 535 |
| Exception Handling | 549 |
| C++ Exception Handling | 549 |
| Win32 Exception Handling | 552 |
| 11 Notifications | 557 |
| User Notifications | 557 |
| Setting a User Notification | 558 |
| Timer Event Notifications | 563 |
| System Event Notifications | 564 |
| The Note Demo Example Program | 566 |
| Querying Scheduled Notifications | 580 |
| PART III COMMUNICATIONS | |
| 12 Serial Communications | 585 |
| Basic Serial Communication | 585 |
| Opening and Closing a Serial Port | 586 |
| Reading from and Writing to a Serial Port | 587 |
| Asynchronous Serial I/O | 588 |
| Configuring the Serial Port | 589 |
| Setting the Port Timeout Values | 592 |
| Querying the Capabilities of the Serial Driver | 594 |
| Controlling the Serial Port | 595 |
| Clearing Errors and Querying Status | 597 |
| Stayin' Alive | 598 |
| The CeChat Example Program | 598 |
| 13 Windows CE Networking | 615 |
| Windows Networking Support | 615 |
| WNet Functions | 616 |
| The ListNet Example Program | 627 |
| 14 Device-to-Device Communication | 637 |
| Basic Sockets | 638 |
| Initializing the Winsock DLL | 638 |
| Stream Sockets | 639 |
| IrSock | 645 |
| Querying and Setting IR Socket Options | 647 |
| Blocking vs. Nonblocking Sockets | 648 |
| The MySquirt Example Program | 651 |
| Bluetooth | 670 |
| Stack | 671 |
| Discovery | 672 |
| Publishing a Service | 682 |
| Bluetooth Communication with Winsock | 685 |
| Bluetooth Communication with Virtual COM Ports | 687 |
| The BtHello Example Program | 692 |
| OBEX | 714 |
| Initialization | 714 |
| Application Callbacks | 714 |
| Device Discovery | 716 |
| OBEX Communication | 718 |
| The ObexSquirt Example Program | 722 |
| 15 Connecting to the Desktop | 747 |
| The Windows CE Remote API | 748 |
| RAPI Overview | 748 |
| Predefined RAPI Functions | 751 |
| The RapiDir Example Program | 758 |
| Custom RAPI Functions | 762 |
| The RapiFind Example Program | 768 |
| The CeUtil Functions | 777 |
| Connection Notification | 781 |
| Registry Method | 782 |
| COM Method | 783 |
| The CnctNote Example Program | 786 |
| Connection Detection on the Windows CE Side | 794 |
| Direct Socket Connections | 795 |
| PART IV DEVICE PROGRAMMING | |
| 16 The Explorer Shell | 799 |
| Working with the Shell | 800 |
| The Shell Namespace | 800 |
| Special Folders | 801 |
| Shortcuts | 803 |
| Configuring the Start Menu | 804 |
| Recent Documents List | 805 |
| Launching Applications | 806 |
| The Taskbar | 807 |
| The TBIcons Example Program | 809 |
| The Out Of Memory Error Dialog Box | 816 |
| Console Applications | 817 |
| The CEFind Example Program | 818 |
| Console Redirection | 822 |
| Hardware Keys | 823 |
| Virtual Codes for Hardware Keys | 823 |
| Using the Application Launch Keys | 825 |
| Dynamically Overriding Application Launch Keys | 827 |
| 17 Programming the Pocket PC | 831 |
| What Is a Pocket PC? | 831 |
| Is It a PDA, a Phone, or Both? | 832 |
| The Pocket PC Screen | 833 |
| Hello Pocket PC | 834 |
| Differences in a Pocket PC Application | 843 |
| Building HelloPPC | 848 |
| The New Menu | 849 |
| The NewMenuX Example | 850 |
| Pocket PC Notifications | 859 |
| Adding a Notification | 860 |
| Modifying a Notification | 863 |
| Removing a Notification | 864 |
| Dialog Boxes | 864 |
| Full-Screen Dialog Boxes | 865 |
| Input Dialogs | 866 |
| Property Sheets | 868 |
| AutoRun | 869 |
| Additional Pocket PC Shell Functions | 871 |
| Full-Screen Windows | 871 |
| Freeing Memory | 871 |
| Controlling the SIP | 872 |
| 18 Extending the Pocket PC | 875 |
| Custom Today Screen Items | 875 |
| Implementing a Today Screen Item | 876 |
| Registering the Custom Item | 880 |
| Debugging a Custom Item | 881 |
| The PowerBar Custom Today Screen Item | 881 |
| Custom Input Methods | 895 |
| The Components of a SIP | 895 |
| Threading Issues with Input Methods | 896 |
| The IInputMethod and IInputMethod2 Interfaces | 897 |
| The IIMCallback and IIMCallback2 Interfaces | 902 |
| The NumPanel Example Input Method | 905 |
| 19 Programming the Smartphone | 929 |
| Introducing the Smartphone | 930 |
| A Smartphone Application | 932 |
| The Smartphone's MenuBar Control | 939 |
| Creating a Smartphone MenuBar Control | 940 |
| Working with the Buttons and Menus | 942 |
| The Back Button and Other Interesting Buttons | 944 |
| Message Boxes | 947 |
| Dialog Boxes | 949 |
| Scrolling Dialogs | 950 |
| Smartphone Controls | 950 |
| Text Controls | 951 |
| Expandable Edit Controls | 953 |
| Spinner Controls | 954 |
| File Operation in the Smartphone | 956 |
| Communication | 958 |
| Phone API | 958 |
| The Connection Manager | 961 |
| SMS Messaging | 965 |
| The SMSTalk Example | 974 |
| Smartphone Security | 995 |
| 20 GAPI, the Game API | 997 |
| GAPI Initialization | 998 |
| Getting Display Information | 999 |
| Querying Button Information | 1000 |
| Accessing the Buttons | 1001 |
| Drawing to the Screen | 1001 |
| Indirect Access to the Frame Buffer | 1002 |
| GAPI Maintenance | 1003 |
| Cleaning Up | 1003 |
| The GAPIShow Example | 1004 |
| PART V ADVANCED WINDOWS CE | |
| 21 System Programming | 1025 |
| The Windows CE Memory Architecture | 1025 |
| Writing Cross-Platform Windows CE Applications | 1028 |
| Platforms and Operating System Versions | 1028 |
| Compile-Time Versioning | 1030 |
| Explicit Linking | 1032 |
| Run-Time Version Checking | 1032 |
| Power Management | 1033 |
| Querying the Power State | 1033 |
| Changing the Power State | 1036 |
| The Power Manager | 1039 |
| 22 Device Drivers and Services | 1045 |
| Basic Drivers | 1045 |
| Driver Names | 1046 |
| The Device Driver Load Process | 1047 |
| Enumerating the Active Drivers | 1050 |
| Reading and Writing Device Drivers | 1052 |
| Writing a Windows CE Stream Device Driver | 1054 |
| The Stream Driver Entry Points | 1055 |
| Device Interface Classes | 1065 |
| Device Driver Power Management | 1067 |
| Building a Device Driver | 1070 |
| Debug Zones | 1070 |
| The Generic Driver Example | 1071 |
| Asynchronous Driver I/O | 1079 |
| Services | 1084 |
| Service Architecture | 1085 |
| The Life of a Service | 1085 |
| Application Control of a Service | 1087 |
| The Service DLL Entry Points | 1089 |
| The Service IOCTL Commands | 1091 |
| Super Service | 1094 |
| Services.exe Command Line | 1098 |
| TickSrv Example Service | 1098 |
| 23 Programming the .NET Compact Framework | 1113 |
| It's Becoming a Managed World | 1113 |
| To .NET or Not to .NET | 1114 |
| A Brief Introduction to Managed Applications | 1116 |
| HelloCF | 1117 |
| Common Language Runtime Basics | 1120 |
| The Framework Class Library | 1125 |
| Windows Forms Applications | 1126 |
| A Basic Windows Forms Application | 1127 |
| Configuring a Top-Level Form | 1133 |
| Compact Framework Unique Classes | 1134 |
| Accessing the Underlying Operating System | 1139 |
| P/Invoke | 1140 |
| P/Invoke Arguments | 1142 |
| The IrSquirtCF Example | 1147 |
| INDEX | 1165 |