You are previewing Programming Windows® Embedded CE 6.0 Developer Reference, 4th Edition.
O'Reilly logo
Programming Windows® Embedded CE 6.0 Developer Reference, 4th Edition

Book Description

Get the definitive guide to programming Windows Embedded CE—now in its fourth edition and updated for version 6.0. This practical reference focuses on the core operating system and includes extensive sample applications in Microsoft® Visual C++®.

Table of Contents

  1. Programming Windows® Embedded CE 6.0 Developer Reference
  2. Dedication
  3. A Note Regarding Supplemental Files
  4. Acknowledgments
  5. Introduction
    1. Just What Is Windows CE?
    2. A Little Windows CE History
      1. The Devices
      2. The Operating System
    3. Why You Should Read This Book
    4. What’s New in the Fourth Edition
    5. Windows CE Development Tools
    6. Target Systems
    7. What’s on the Web Site
    8. Other Sources
    9. Support
      1. Visit the Microsoft Press Web Site
    10. Updates and Feedback
  6. I. Windows Programming Basics
    1. 1. Hello Windows CE
      1. What Is Different About Windows CE
        1. Fewer Resources in Windows CE Devices
        2. Unicode
        3. New Controls
        4. Componentization
        5. Win32 Subset
      2. It’s Still Windows Programming
        1. Hungarian Notation
      3. Your First Windows CE Application
        1. Building Your First Application
        2. Running the Program
        3. What’s Wrong?
      4. Hello2
      5. Anatomy of a Windows-Based Application
        1. The Window
        2. The Window Class
        3. The Window Procedure
        4. The Life of a Message
        5. Registering the Window Class
        6. Creating the Window
        7. The Message Loop
        8. The Window Procedure
          1. WM_PAINT
          2. WM_DESTROY
      6. HelloCE
        1. The Code
          1. InitInstance
          2. MainWndProc
          3. DoPaintMain and DoDestroyMain
      7. Running HelloCE
    2. 2. Drawing on the Screen
      1. Painting Basics
        1. Valid and Invalid Regions
        2. Device Contexts
      2. Writing Text
        1. Device Context Attributes
          1. Foreground and Background Colors
          2. Text Alignment
          3. Drawing Mode
        2. The TextDemo Example Program
        3. Fonts
          1. Creating a Font
          2. Selecting a Font into a Device Context
          3. Querying a Font’s Characteristics
          4. Destroying a Font
          5. Enumerating Fonts
        4. The FontList Example Program
          1. Unfinished Business
      3. Bitmaps
        1. Device-Dependent Bitmaps
        2. Device-Independent Bitmaps
        3. DIB Sections
        4. Drawing Bitmaps
        5. AlphaBlending
      4. Lines and Shapes
        1. Lines
          1. Pens
        2. Shapes
          1. Brushes
          2. Rectangles
          3. Circles and Ellipses
          4. Round Rectangles
          5. Polygons
        3. Fill Functions
        4. The Shapes Example Program
    3. 3. Input: Keyboard, Mouse, and Touch Screen
      1. The Keyboard
        1. Input Focus
        2. Keyboard Messages
        3. Keyboard Functions
          1. Testing for the Keyboard
        4. The KeyTrac Example Program
      2. The Mouse and the Touch Screen
        1. Mouse Messages
        2. Working with the Touch Screen
          1. Stylus Messages
          2. Inking
          3. Input Focus and Mouse Messages
          4. Right-Button Clicks
        3. The TicTac1 Example Program
    4. 4. Windows, Controls, and Menus
      1. Child Windows
      2. Window Management Functions
        1. Enumerating Windows
        2. Finding a Window
        3. Moving a Window
        4. Editing the Window Structure Values
          1. Changing the Style Flags
      3. Windows Controls
        1. Working with Controls
        2. Button Controls
          1. Push Buttons
          2. Check Boxes
          3. Radio Buttons
          4. Customizing the Appearance of a Button
          5. Owner-Draw Buttons
        3. The Edit Control
        4. The List Box Control
        5. The Combo Box Control
        6. Static Controls
        7. The Scroll Bar Control
          1. Scroll Bar Messages
          2. Configuring a Scroll Bar
        8. Controls and Colors
      4. Menus
        1. Handling Menu Commands
      5. Resources
        1. Resource Scripts
        2. Icons
        3. Accelerators
        4. Bitmaps
        5. Strings
      6. The DOIView Example Program
    5. 5. Common Controls and Windows CE
      1. Programming Common Controls
      2. The Common Controls
        1. The Command Bar
          1. Creating a Command Bar
          2. Command Bar Menus
          3. Command Bar Buttons
          4. Referencing Images
          5. Working with Command Bar Buttons
          6. Drop-Down Buttons
          7. Combo Boxes on the Command Bar
          8. Other Command Bar Functions
          9. The CmdBar Example
        2. Other Menu Controls
        3. The Month Calendar Control
          1. Initializing the Control
          2. Month Calendar Notifications
        4. The Date and Time Picker Control
          1. Creating a Date and Time Picker Control
          2. Customizing the Format
        5. The List View Control
          1. Styles in Report Mode
          2. Virtual List View
        6. The CapEdit Control
      3. Other Common Controls
        1. The Status Bar Control
          1. The Status Bar Control
          2. The Tab Control
          3. The Trackbar Control
          4. The Progress Bar Control
          5. The Up-Down Control
          6. The Toolbar Control
          7. The Tree View Control
          8. The Animation Control
      4. Unsupported Common Controls
    6. 6. Dialog Boxes and Property Sheets
      1. Dialog Boxes
        1. Dialog Box Resource Templates
        2. Creating a Dialog Box
        3. Dialog Box Procedures
          1. Full-Screen Dialog Boxes
        4. Modeless Dialog Boxes
        5. Property Sheets
          1. Creating a Property Sheet
          2. Creating a Property Page
          3. Property Page Procedures
          4. Switching Pages
          5. Closing a Property Sheet
        6. Common Dialogs
      2. The DlgDemo Example Program
  7. II. Windows CE Programming
    1. 7. Memory Management
      1. Memory Basics
        1. About RAM
        2. About ROM
        3. About Virtual Memory
          1. Paged Memory
          2. Querying the System Memory
        4. An Application’s Address Space
      2. The Different Kinds of Memory Allocation
        1. Virtual Memory
          1. Allocating Virtual Memory
          2. Regions versus Pages
          3. Freeing Virtual Memory
          4. Changing and Querying Access Rights
          5. The VirtualxxxEx API
        2. Heaps
        3. The Local Heap
          1. Allocating Memory on the Local Heap
          2. Freeing Memory on the Local Heap
          3. Resizing and Querying the Size of Local Heap Memory
        4. Separate Heaps
          1. Creating a Separate Heap
          2. Allocating Memory in a Separate Heap
          3. Freeing Memory in a Separate Heap
          4. Resizing and Querying the Size of Memory in a Separate Heap
          5. Destroying a Separate Heap
          6. Managing a Separate Heap
        5. The Stack
        6. Static Data
        7. String Resources
        8. Selecting the Proper Memory Type
        9. Managing Low-Memory Conditions
          1. The WM_HIBERNATE Message
          2. Memory Thresholds
    2. 8. Modules, Processes, and Threads
      1. Modules
      2. Processes
        1. Creating a Process
        2. Terminating a Process
        3. Other Processes
      3. Threads
        1. The System Scheduler
          1. Never Do This!
        2. Creating a Thread
        3. Setting and Querying Thread Priority
        4. Setting a Thread’s Time Quantum
        5. Suspending and Resuming a Thread
      4. Fibers
      5. Thread Local Storage
      6. Synchronization
        1. Events
        2. Waiting…
          1. Waiting on a Single Object
          2. Waiting on Processes and Threads
          3. Waiting on Multiple Objects
          4. Waiting While Dealing with Messages
        3. Semaphores
        4. Mutexes
        5. Duplicating Synchronization Handles
        6. Critical Sections
        7. Interlocked Variable Access
      7. Interprocess Communication
        1. Finding Other Processes
        2. WM_COPYDATA
        3. Named Memory-Mapped Objects
          1. Naming a Memory-Mapped Object
        4. Point-to-Point Message Queues
        5. Communicating with Files and Databases
      8. The XTalk Example Program
      9. Exception Handling
        1. C++ Exception Handling
          1. Using Exceptions to Report Errors
          2. The try, catch Block
        2. Win32 Exception Handling
          1. The __try, __except Block
          2. Determining the Problem
          3. Generating Your Own Exceptions
          4. The __try, __finally Block
    3. 9. The Windows CE File System
      1. The Windows CE File System API
        1. Standard File I/O
          1. Creating and Opening Files
          2. Reading and Writing
          3. Moving the File Pointer
          4. Closing a File
          5. Truncating a File
          6. Getting File Information
          7. File Times
          8. File Size and Other Information
        2. Memory-Mapped Files
          1. Memory-Mapped Files
        3. Navigating the File System
          1. File and Directory Management
          2. Creating a Temporary File
          3. Finding Files
          4. Distinguishing Drives from Directories
      2. Dealing with Storage
        1. The Object Store
        2. Accessing Volumes With the File API
        3. The Storage Manager
          1. Opening, Querying a Storage Device
          2. Enumerating Storage Devices
          3. Enumerating Partitions
          4. Working with Partitions
          5. Formatting Volumes
          6. Finding the FormatVolume API
    4. 10. The Registry
      1. Registry Organization
      2. The Registry API
        1. Opening and Creating Keys
        2. Reading Registry Values
        3. Writing Registry Values
        4. Deleting Keys and Values
        5. Enumerating Registry Keys
        6. Flushing the Registry
        7. Registry Change Notifications
        8. The RegView Example Program
    5. 11. Windows CE Databases
      1. The Two Databases
        1. Basic Definitions
          1. Designing a Database
          2. Database Volumes
        2. The Database API
          1. Mounting a Database Volume
          2. Enumerating Mounted Database Volumes
          3. Flushing a Database Volume
          4. Unmounting a Database Volume
          5. Using the Object Store as a Database Volume
          6. Creating a Database
          7. Opening a Session
          8. Opening a Database
          9. Seeking (or Searching for) a Record
          10. Changing the Sort Order
          11. Reading a Record
          12. Writing a Record
          13. Reading and Writing Stream Properties
          14. Using Transactions
          15. Deleting Properties, Records, and Entire Databases
          16. Enumerating Databases
          17. Querying Object Information
    6. 12. Notifications
      1. User Notifications
        1. Setting a User Notification
          1. Configuring a User Notification
          2. Acknowledging a User Notification
      2. Timer Event Notifications
      3. System Event Notifications
      4. The NoteDemo Example Program
      5. Querying Scheduled Notifications
      6. Bubble Notifications
        1. Adding a Notification
        2. Modifying a Notification
        3. Removing a Notification
  8. III. Advanced Windows CE
    1. 13. Windows CE Networking
      1. Windows Networking Support
        1. WNet Functions
          1. Conventions of UNC
          2. Mapping a Remote Drive
          3. Disconnecting a Remote Resource
          4. Enumerating Network Resources
          5. Querying Connections and Resources
        2. The ListNet Example Program
      2. TCP/IP Programming
        1. Socket Programming
          1. Initializing the Winsock DLL
          2. Server Side: Binding a Socket to an Address
          3. Accepting a Connection
          4. Client Side: Connecting a Socket to a Server
          5. Sending and Receiving Data
          6. Closing a Socket
          7. A Simple Example
        2. Blocking versus Nonblocking Sockets
    2. 14. Device-to-Device Communication
      1. Infrared Communication
        1. IR Basics
        2. Discovery
        3. Publishing an IR Service
        4. Querying and Setting IR Socket Options
        5. The MySquirt Example Program
      2. Bluetooth
        1. Stack
        2. Discovery
          1. Device Discovery
          2. Service Discovery
        3. Publishing a Service
          1. SDP Records
        4. Bluetooth Communication with Winsock
          1. Server Side
          2. Client Side
        5. Bluetooth Communication with Virtual COM Ports
          1. Server Side
          2. Client Side
        6. The BtSquirt Example Program
    3. 15. System Programming
      1. The Windows CE Memory Architecture
        1. Application Space
        2. Kernel Space
      2. Writing Cross-Platform Windows CE Applications
        1. Platforms and Operating System Versions
        2. Compile-Time Versioning
        3. Explicit Linking
        4. Run-Time Version Checking
      3. Power Management
        1. Defining the Meaning of “Off”
        2. Querying the Power State
        3. The Power Manager
          1. Power Notifications
          2. Setting the Power State
        4. Managing Power without the Power Manager
          1. Powering Down
          2. Turning Off the Screen
          3. Powering Up the System
          4. Preventing the System from Powering Down
    4. 16. Serial Communications
      1. Basic Serial Communication
        1. Opening and Closing a Serial Port
        2. Reading from and Writing to a Serial Port
        3. Asynchronous Serial I/O
        4. Configuring the Serial Port
        5. Setting the Port Timeout Values
        6. Querying the Capabilities of the Serial Driver
        7. Controlling the Serial Port
        8. Clearing Errors and Querying Status
        9. Stayin’ Alive
      2. The CeChat Example Program
    5. 17. Device Drivers and Services
      1. Basic Drivers
        1. Driver Names
        2. The Device Driver Load Process
          1. Loading a Driver in User Mode
        3. Enumerating the Active Drivers
        4. Reading and Writing Device Drivers
      2. Writing a Windows CE Stream Device Driver
        1. The Stream Driver Entry Points
          1. xxx_Init
          2. xxx_PreDeinit
          3. xxx_Deinit
          4. xxx_Open
          5. xxx_PreClose
          6. xxx_Close
          7. xxx_Read
          8. xxx_Write
          9. xxx_Seek
          10. xxx_PowerDown
          11. xxx_PowerUp
          12. xxx_IOControl
        2. Managing Buffers
        3. Device Interface Classes
          1. Advertising an Interface
          2. Monitoring for an Interface
        4. Device Driver Power Management
          1. Power Management Functions for Devices
          2. IOCTL_POWER_CAPABILITIES
          3. IOCTL_REGISTER_POWER_RELATIONSHIP
          4. IOCTL_POWER_GET
          5. IOCTL_POWER_QUERY
          6. IOCTL_POWER_SET
      3. Building a Device Driver
        1. Debug Zones
        2. The Generic Driver Example
      4. Services
        1. Service Architecture
        2. The Life of a Service
        3. Application Control of a Service
        4. The Service DLL Entry Points
          1. xxx_Init
          2. xxx_Deinit
          3. xxx_Open
          4. xxx_Close
          5. xxx_IOControl
        5. The Service IOCTL Commands
          1. IOCTL_SERVICE_START
          2. IOCTL_SERVICE_STOP
          3. IOCTL_SERVICE_REFRESH
          4. IOCTL_SERVICE_INSTALL
          5. IOCTL_SERVICE_UNINSTALL
          6. IOCTL_SERVICE_STATUS
          7. IOCTL_SERVICE_CONSOLE
          8. IOCTL_SERVICE_CONTROL
          9. IOCTL_SERVICE_DEBUG
          10. IOCTL_SERVICE_SUPPORTED_OPTIONS
        6. Super Service
          1. Programmatically Controlling the Super Service
          2. SuperService IOCTLs
          3. IOCTL_SERVICE_REGISTER_SOCKADDR
          4. IOCTL_SERVICE_STARTED
          5. IOCTL_SERVICE_DEREGISTER_SOCKADDR
          6. IOCTL_SERVICE_CONNECTION
          7. IOCTL_SERVICE_NOTIFY_ADDR_CHANGE
        7. Services.exe Command Line
        8. TickSrv Example Service
  9. Index
  10. About the Author
  11. Copyright