• Cover
  • Acknowledgments
  • Introduction
    • MFC, ATL, and WFC -- Is MFC Dead?
    • C++ vs. Java
    • Who Can Use This Book
    • What's Not Covered
    • How to Use This Book
    • The Organization of This Book
    • Win32 vs. Win16
    • Windows 95 and Windows 98 vs. Windows NT
    • Going Further with Windows: The For Win32 Programmers Sidebars
    • Using the Companion CD-ROM
    • Technical Notes and Sample Programs
    • Support
  • Part I: Windows, Visual C++, and Application Framework Fundmentals
    • Chapter One -- Microsoft Windows and Visual C++
      • The Windows Programming Model
      • The Visual C++ Components
    • Chapter Two -- The Microsoft Foundation Class Library Application Framework
      • Why Use the Application Framework?
      • What's an Application Framework?
      • MFC Library Message Mapping
      • Documents and Views
    • Part II: The MFC Library View Class
      • Chapter Three -- Getting Started with AppWizard --
        • What's a View?
        • Single Document Interface vs. Multiple Document Interface
        • The Do-Nothing Application -- EX03A
        • The CEx03aView View Class
        • Drawing Inside the View Window -- The Windows Graphics Device Interface
        • A Preview of the Resource Editors
        • Win32 Debug Target vs. Win32 Release Target
        • Enabling the Diagnostic Macros
        • Understanding Precompiled Headers
        • Two Ways to Run a Program
      • Chapter Four -- Basic Event Handling, Mapping Modes, and a Scrolling View
        • Getting User Input--Message Map Functions
        • Mapping Modes
        • A Scrolling View Window
        • Other Windows Messages
      • Chapter Five -- The Graphics Device Interface, Colors, and Fonts
        • The Device Context Classes
        • GDI Objects
        • Windows Color Mapping
        • Fonts
        • The EX05A Example
        • The EX05B Example
        • The EX05C Example -- CScrollView Revisited
      • Chapter Six -- The Modal Dialog and Windows Common Controls
        • Modal vs. Modeless Dialogs
        • Resources and Controls
        • Programming a Modal Dialog
        • The Dialog That Ate Cincinnati -- The EX06A Example
        • Enhancing the Dialog Program
        • Identifying Controls: CWnd Pointers and Control IDs
        • Setting the Color for the Dialog Background and for Controls
        • Painting Inside the Dialog Window
        • Adding Dialog Controls at Runtime
        • Using Other Control Features
        • Windows Common Controls
        • The EX06B Example
      • Chapter Seven -- The Modeless Dialog and Windows Common Dialogs
        • Modeless Dialogs
        • The CFormView Class -- A Modeless Dialog Alternative
        • The Windows Common Dialogs
      • Chapter Eight -- Using ActiveX Controls
        • ActiveX Controls vs. Ordinary Windows Controls
        • Installing ActiveX Controls
        • The Calendar Control
        • ActiveX Control Container Programming
        • The EX08A Example -- An ActiveX Control Dialog Container
        • ActiveX Controls in HTML Files
        • Creating ActiveX Controls at Runtime
        • The EX08B Example -- The Web Browser ActiveX Control
        • The EX08C Example -- A Complete Dual-Window Web Browser
        • Picture Properties
        • Bindable Properties -- Change Notifications
        • Other ActiveX Controls
      • Chapter Nine -- Internet Explorer 4 Common Controls
        • An Introduction to the New Internet Explorer 4 Common Controls
        • The EX09A Example
      • Chapter Ten -- Win32 Memory Management
        • Processes and Memory Space
        • How Virtual Memory Works
        • The VirtualAlloc Function -- Committed and Reserved Memory
        • The Windows Heap and the GlobalAlloc Function Family
        • The Small-Block Heap, the C++ new and delete Operators, and _heapmin
        • Memory-Mapped Files
        • Accessing Resources
        • Some Tips for Managing Dynamic Memory
        • Optimizing Storage for Constant Data
      • Chapter Eleven -- Bitmaps
        • GDI Bitmaps and Device-Independent Bitmaps
        • Using GDI Bitmaps
        • Using Bitmaps to Improve the Screen Display
        • DIBs and the CDib Class
        • Going Further with DIBs
        • Putting Bitmaps on Pushbuttons
      • Chapter Twelve -- Windows Message Processing and Multi-threaded Programming
        • Windows Message Processing
        • On-Idle Processing
        • Multithreaded Programming
      • Part III: The Document-View Architecture
        • Chapter Thirteen -- Menus, Keyboard Accelerators, the Rich Edit Control, and Property Sheets
          • The Main Frame Window and Document Classes
          • Windows Menus
          • Keyboard Accelerators
          • Command Processing
          • The Application Framework's Built-In Menu Items
          • MFC Text Editing Options
          • The EX13A Example
          • Property Sheets
          • The EX13A Example Revisited
          • The CMenu Class
          • Creating Floating Pop-Up Menus
          • Extended Command Processing
        • Chapter Fourteen -- Toolbars and Status Bars
          • Control Bars and the Application Framework
          • The Toolbar
          • ToolTips
          • Locating the Main Frame Window
          • The EX14A Toolbar Example
          • The Status Bar
          • The EX14B Status Bar Example
          • The Internet Explorer Rebar Toolbar
          • The EX14C Rebar Example
        • Chapter Fifteen -- A Reusable Frame Window Base Class
          • Why Reusable Base Classes Are Difficult to Write
          • The CPersistentFrame Class
          • The CFrameWnd Class and the ActivateFrame Member Function
          • The PreCreateWindow Member Function
          • The Windows Registry
          • Using the CString Class
          • The Position of a Maximized Window
          • Control Bar Status and the Registry
          • Static Data Members
          • The Default Window Rectangle
          • The EX15A Example
          • Persistent Frames in MDI Applications
        • Chapter Sixteen -- Separating the Document from Its View
          • Document-View Interaction Functions
          • The Simplest Document-View Application
          • The CFormView Class
          • The CObject Class
          • Diagnostic Dumping
          • The EX16A Example
          • A More Advanced Document-View Interaction
          • The CDocument::DeleteContents Function
          • The CObList Collection Class
          • The EX16B Example
          • Two Exercises for the Reader
        • Chapter Seventeen -- Reading and Writing Documents -- SDI Applications
          • Serialization -- What Is It?
          • The SDI Application
          • The EX17A Example -- SDI with Serialization
          • Explorer Launch and Drag and Drop
        • Chapter Eighteen -- Reading and Writing Documents -- MDI Applications
          • The MDI Application
          • The EX18A Example
        • Chapter Nineteen -- Printing and Print Preview
          • Windows Printing
          • Print Preview
          • Programming for the Printer
          • The EX19A Example -- A Wysiwyg Print Program
          • Template Collection Classes Revisited -- The CArray Class
          • The EX19B Example -- A Multipage Print Program
        • Chapter Twenty -- Splitter Windows and Multiple Views
          • The Splitter Window
          • View Options
          • Dynamic and Static Splitter Windows
          • The EX20A Example -- A Single View Class SDI Dynamic Splitter
          • The EX20B Example -- A Double View Class SDI Static Splitter
          • The EX20C Example -- Switching View Classes Without a Splitter
          • The EX20D Example -- A Multiple View Class MDI Application
        • Chapter Twenty-One -- Context-Sensitive Help
          • The Windows WinHelp Program
          • The Application Framework and WinHelp
          • A Help Example -- No Programming Required
          • The MAKEHELP Process
          • Help Command Processing
          • A Help Command Processing Example -- EX21B
        • Chapter Twenty-Two -- Dynamic Link Libraries
          • Fundamental DLL Theory
          • MFC DLLs -- Extension vs. Regular
          • A Custom Control DLL
        • Chapter Twenty-Three -- MFC Programs Without Document or View Classes
          • The EX23A Example -- A Dialog-Based Application
          • The EX23B Example -- An SDI Application
          • The EX23C Example -- An MDI Application
        • Part IV: Active X: COM, Automation, OLE
          • Chapter Twenty-Four -- The Component Object Model
            • ActiveX Technology Background
            • The Component Object Model
            • Real COM with the MFC Library
            • Containment and Aggregation vs. Inheritance
          • Chapter Twenty-Five -- Automation
            • Connecting C++ with Visual Basic for Applications
            • Automation Clients and Automation Components
            • Microsoft Excel -- A BetterVisual Basic than Visual Basic
            • Properties, Methods, and Collections
            • The Problem That Automation Solves
            • The IDispatch Interface
            • Automation Programming Choices
            • An MFC Automation Component
            • An MFC Automation Client Program
            • An Automation Client ProgramUsing the Compiler's #import Directive
            • The VARIANT Type
            • The COleVariant Class
            • Automation Examples
            • VBA Early Binding
          • Chapter Twenty-Six -- Uniform Data Transfer -- Clipboard Transfer and OLE Drag and Drop
            • The IDataObject Interface
            • The FORMATETC and STGMEDIUM Structures
            • MFC Uniform Data Transfer Support
            • The MFC CRectTracker Class
            • The EX26A Example -- A Data Object Clipboard
            • MFC Drag and Drop
            • The EX26B Example -- OLE Drag and Drop
            • Windows Applications and Drag and Drop -- Dobjview
            • Conclusion
          • Chapter Twenty-Seven -- Structured Storage
            • Compound Files
            • Storages and the IStorage Interface
            • Streams and the IStream Interface
            • The ILockBytes Interface
            • The EX27A Example -- Structured Storage
            • Structured Storage and Persistent COM Objects
            • The EX27B Example -- A Persistent DLL Component
            • The EX27C Example -- A Persistent Storage Client Program
            • Compound File Fragmentation
            • Other Compound File Advantages
          • Chapter Twenty-Eight -- OLE Embedded Components and Containers
            • Embedding vs. In-Place Activation (Visual Editing)
            • Mini-Servers vs. Full Servers (Components) -- Linking
            • The Dark Side of Visual Editing
            • Windows Metafiles and Embedded Objects
            • The MFC OLE Architecturefor Component Programs
            • The EX28A Example -- An MFC In-Place_Activated Mini-Server
            • Container_Component Interactions
            • Component States
            • An Interface Summary
            • OLE Helper Functions
            • An OLE Embedding Container Application
            • The EX28B Example -- An Embedding Container
            • The EX28C Example -- An OLE Embedded Component
          • Chapter Twenty-Nine -- Introducing the Active Template Library
            • Revisiting COM
            • Writing COM Code
            • The COM Infrastructure
            • The ATL Roadmap
            • Client-Side ATL Programming
            • Server-Side ATL Programming
            • Conclusion
          • Chapter Thirty -- ATL and ActiveX Controls
            • ActiveX Controls
            • Using ATL to Write a Control
            • Conclusion
          • Part V: Database Management
            • Chapter Thirty-One -- Database Management with Microsoft ODBC
              • The Advantages of Database Management
              • Structured Query Language
              • The ODBC Standard
              • The MFC ODBC Classes -- CRecordset and CDatabase
              • The Student Registration Database
              • The EX31A Recordset Example
              • The EX31A Program Elements
              • Filter and Sort Strings
              • Joining Two Database Tables
              • The MFC CRecordView Class
              • The EX31B Record View Example
              • Multiple Recordsets
              • ODBC Multithreading
              • Bulk Row Fetches
              • Using Recordsets Without Binding
            • Chapter Thirty-Two -- Database Management with Microsoft Data Access Objects
              • DAO, COM, and the Microsoft Jet Database Engine
              • DAO and VBA
              • DAO and MFC
              • What Databases Can You Open with DAO?
              • Using DAO in ODBC Mode -- Snapshots and Dynasets
              • DAO Table-Type Recordsets
              • DAO QueryDefs and TableDefs
              • DAO Multithreading
              • Displaying Database Rows in a Scrolling Window
              • Programming a Dynamic Recordset
              • The EX32A Example
              • The EX32A Resource File
              • Running the EX32A Program
            • Chapter Thirty-Three -- The OLE DB Templates
              • Why OLE DB?
              • Basic OLE DB Architecture
              • Basic OLE DB Template Architecture
              • Creating an OLE DB Consumer
              • Using the OLE DB Consumer Code
              • Creating an OLE DB Provider
              • Conclusion
            • Part VI: Programming for the Internet
              • Chapter Thirty-Four -- TCP/IP, Winsock, and WinInet
                • To COM or Not to COM
                • Internet Primer
                • Build Your Own $99 Intranet
                • Winsock
                • Building a Web Server with CHttpBlockingSocket
                • Building a Web Client with CHttpBlockingSocket
                • WinInet
                • Building a Web Client with the MFC WinInet Classes
                • Asynchronous Moniker Files
              • Chapter Thirty-Five -- Programming the Microsoft Internet Information Server
                • IIS Alternatives
                • Microsoft IIS
                • ISAPI Server Extensions
                • A Practical ISAPI Server Extension -- ex35a.dll
                • ISAPI Database Access
                • Using HTTP Cookies to Link Transactions
                • WWW Authentication
                • ISAPI Filters
                • A Sample ISAPI Filter -- ex35b.dll, ex35c.exe
              • Chapter Thirty-Six -- ActiveX Document Servers and the Internet
                • ActiveX Document Theory
                • ActiveX Document Server Example EX36A
                • ActiveX Document Server Example EX36B
                • Going Further with ActiveX Document Servers
              • Chapter Thirty-Seven -- Introducing Dynamic HTML
                • The DHTML Object Model
                • Visual C++ and DHTML
              • Chapter Thirty-Eight -- Visual C++ for Windows CE
                • Visual C++ for Windows CE
                • For More Information on Windows CE...
              • Appendixes
                • Appendix A -- Message Map Functions in the Microsoft Foundation Class Library
                • Appendix B -- MFC Library Runtime Class Identification and Dynamic Object Creation
                  • Getting an Object's Class Name at Runtime
                  • The MFC CRuntimeClass Structure and the RUNTIME_CLASS Macro
                  • Dynamic Creation
                  • A Sample Program
                • About the Electronic Book
                • About Microsoft Press