Visual C++® 6 Unleashed

Book description

Visual C++ 6 Unleashed provides comprehensive coverage of the core topics for Visual C++ 6 programming. This book skips the beginning level material and jumps right in to Visual C++. By the end of the book, you will be able to master the 32-bit power of Windows using Visual C++ as your programming language. Topics include mastering the debugger, using and integrating HTML help, creating custom AppWizards, customizing the IDE with add-ins, writing multi-threaded MFC applications, developing NT services, using advanced UI techniques, and much more.

Table of contents

  1. Copyright
    1. Dedication
  2. About the Authors
  3. About the Contributors
  4. Acknowledgments
  5. Tell Us What You Think!
  6. Introduction
    1. How to Use This Book
    2. What You Need to Use This Book
    3. What's New in Visual C++ 6.0
    4. Contacting the Main Author
  7. I. Introduction
    1. 1. The Visual C++ 6.0 Environment
      1. Developer Studio
        1. View Windows
        2. Toolbars
      2. The Project Workspace
      3. The Workspace Window
        1. The FileView
        2. The ClassView
      4. Project Configurations
        1. Project Settings
      5. Converting Older Projects
      6. Working with Multiple Projects
      7. Working with Resources
        1. The Resource View
        2. Importing Resources
        3. Managing Resource IDs
          1. Working with Resource Symbols
          2. Working with Resource Includes
        4. Resource Templates
      8. Editing Resources
        1. Dialog Boxes
          1. Adding Controls
          2. Control Properties
          3. Laying Out Your Controls
          4. Tab Order
          5. Testing Your Dialog Box
        2. Editing Menus
        3. Other Resources
      9. MFC AppWizard
        1. What MFC AppWizard Can Do for You
        2. Starting MFC AppWizard
        3. Project Types
          1. ATL COM AppWizard
          2. Cluster Resource Type Wizard
          3. Custom AppWizard
          4. Database Project
          5. DevStudio Add-In Wizard
          6. Extended Stored Procedure Wizard
          7. ISAPI Extension Wizard
          8. Makefile
          9. MFC ActiveX ControlWizard
          10. MFC AppWizard (DLL)
          11. MFC AppWizard (EXE)
          12. Utility Project
          13. Win32 Application
          14. Win32 Console Application
          15. Win32 Dynamic Link Library
          16. Win32 Static Library
          17. Other Project Types
      10. ClassWizard
        1. Message Maps
        2. Member Variables
        3. Automation
        4. ActiveX Events
        5. Class Info
        6. Adding a Class
      11. Component Gallery
      12. Integrated Debugger
        1. Looking at Your Data
        2. Debugging After Exceptions
      13. Command-Line Tools
      14. Other Tools
        1. Spy++
        2. MFC Tracer
        3. Register Control
        4. ActiveX Control Test Container
        5. OLE/COM Object Viewer
        6. Error Lookup
        7. WinDiff
        8. Help Workshop
      15. Summary
  8. II. MFC Programming
    1. 2. MFC Class Library Overview
      1. The Application Framework
      2. Creating an MFC Application with MFC AppWizard
        1. Starting MFC AppWizard
        2. Getting to Know Your New Application
        3. Classes Created by MFC AppWizard
        4. CDocument, CView, and Frame Classes
      3. The CWinApp Class
      4. The CWinThread Class
      5. The CCmdTarget Class
      6. The CObject Class
        1. Serialization
          1. The DECLARE_SERIAL and IMPLEMENT_SERIAL Macros
          2. Serialize()
          3. Serialization Operators
          4. Serializing Different Versions
      7. Runtime Type Information
        1. Using MFC Runtime Type Information
          1. IsKindOf() and RUNTIME_CLASS()
          2. STATIC_DOWNCAST and DYNAMIC_DOWNCAST
          3. ASSERT_KINDOF()
      8. Debugging Support
        1. AssertValid()
        2. The ASSERT Macro
        3. Dump()
        4. The TRACE() Macro
      9. Putting It All Together
        1. WinMain()
        2. InitApplication() and InitInstance()
        3. LoadStdProfileSettings()
        4. Working with the Command Line
        5. Creating the Main Window
      10. The Message Pump
        1. OnIdle()
      11. Summary
    2. 3. MFC Message Handling Mechanism
      1. Message Categories
      2. Message Handling in MFC
      3. Message Dispatching
      4. Message Handling with ClassWizard
      5. Creating Your Own Message Maps
        1. Populating the Message Map
          1. Predefined Windows Message Handlers
          2. Other Windows Messages
          3. Command Messages
          4. Control Notifications
          5. Command and Control Ranges
          6. Registered Messages
          7. Other Message Map Macros
        2. Inside the Message Map
        3. Implementing Handler Functions
        4. PreTranslateMessage()
      6. A Common Problem with MFC Message Maps
      7. Summary
    3. 4. The Document View Architecture
      1. Examining the Document View Architecture
        1. Single Versus Multiple Document Applications
        2. Document Classes
        3. View Classes
        4. Frames
        5. Document Templates
      2. Creating Your Application
        1. Creating Your Document Class
        2. Document Data
        3. The Dirty Flag
        4. Serialize()
        5. OnNewDocument()
        6. DeleteContents()
        7. OnOpenDocument()
        8. OnSaveDocument()
        9. OnCloseDocument()
        10. ReportSaveLoadException()
        11. Accessing Your Document
      3. Using the View Classes
        1. CScrollView
          1. Setting Up the Scrollbars
          2. Drawing with CScrollView
        2. CFormView and CRecordView
        3. Control Views
          1. Setting Control View Styles
          2. Handling Control Notifications
        4. CEditView
          1. Working with CEditView Data
        5. Using CRichEditView
        6. CListView and CTreeView
      4. Using Document Templates
        1. The EmpList Sample Project
        2. Creating a Document Template
          1. The Document String Resource
          2. Using Multiple Document Templates
        3. Creating a Different View for a Document
          1. CDocument::OnChangedViewList()
          2. UpdateAllViews()
        4. Accessing Views from Your Document
      5. Working with Frames
        1. Status Bars
          1. Customizing the Status Bar
        2. Adding a Toolbar
        3. Floating and Docking Toolbars
      6. More on Working with Menus
        1. Updating the User Interface
        2. Pop-Up Menus
        3. Creating Menus Dynamically
      7. Adding Splitters to Your Application
        1. Dynamic Splitters
        2. Creating Different Views
        3. Static Splitters
      8. Adding Drag and Drop to Your Application
        1. Enabling Drag and Drop
        2. Handling WM_DROPFILES Messages
      9. Summary
    4. 5. Creating and Using Dialog Boxes
      1. Handling Dialog Boxes in MFC
        1. Creating Dialog Box Template Resources
        2. Creating a CDialog-Derived Class
        3. Displaying the Dialog Box
        4. Dialog Box Coordinates
        5. Changing the Input Focus and Default Buttons
      2. Dialog Box Data Exchange and Validation
        1. Mapping Member Variables to Controls
        2. The Data Exchange and Validation Mechanism
        3. Initializing the Dialog Box Controls
        4. Retrieving Data from the Controls
        5. Responding to Control Notifications
        6. Dynamically Mapping Controls
        7. Responding to OK and Cancel
      3. Derived Control Classes in Dialog Boxes
        1. Creating a Derived Control
        2. Customizing the Derived Control
        3. Using the Derived Control in a Dialog Box
      4. Modeless Dialog Boxes
        1. Modeless Dialog Box Resource Templates
        2. Creating and Destroying Modeless Dialog Boxes
        3. Tracking Modeless Dialog Boxes
        4. Dialog Bars
      5. Summary
    5. 6. Working with Device Contexts and GDI Objects
      1. Device Contexts in MFC
        1. The CDC Class
        2. The CClientDC Class
        3. The CPaintDC Class
        4. The CMetaFileDC Class
      2. Brushes and Pens
        1. Pens and the CPen Class
        2. Selecting Pens into the Device Context
        3. Using Stock Pens
        4. Drawing with Pens
        5. Brushes and the CBrush Class
        6. Selecting Brushes into the Device Context
        7. Using Stock Brushes
        8. Drawing with Brushes
      3. MFC Classes for GDI Operations
        1. The CPoint Class
        2. The CSize Class
        3. The CRect Class
        4. The CRgn Class and Clipping
      4. Working with Fonts
        1. Fonts and the CFont Class
        2. Selecting Fonts into the Device Context
        3. Stock Fonts
        4. Device Context Font Interrogation Functions
        5. Text-Rendering Functions
      5. Creating and Loading Bitmaps
        1. Creating a Bitmap Resource with the Resource Editor
        2. Loading a Bitmap
        3. Creating Bitmaps
      6. Drawing with Bitmaps
        1. Bitmap Copying
      7. Creating a Device-Independent Bitmap Class
        1. Creating a DIB
        2. Creating a DIB from a Device-Dependent Bitmap
        3. Drawing with a DIB
      8. Summary
    6. 7. Creating and Using Property Sheets
      1. Understanding Property Sheets
      2. Creating a Property Sheet
        1. Creating the Property Page Resources
        2. Creating CPropertyPage-Derived Classes
        3. Creating a CPropertySheet-Derived Class
        4. Adding the Property Pages
        5. Creating a Modeless Property Sheet
      3. Responding to Property Sheet Messages
        1. Initializing the Property Pages
        2. Property Page Activation and Deactivation
        3. Handling Messages from OK, Apply, and Cancel Buttons
        4. Sending Messages Between Property Pages
      4. Customizing the Standard Property Sheet
        1. Property Page Management
        2. Creating a Wizard Mode Property Sheet
        3. Using the New CPropertySheetEx and CPropertyPageEx Classes
        4. Adding Help Buttons and Help Support
      5. Understanding the Win32 Sequence of Events
      6. Summary
    7. 8. Working with the File System
      1. File System Overview
        1. The FAT File System
        2. Protected-Mode FAT
        3. The FAT-32 File System
        4. The HPFS File System
        5. The NTFS File System
        6. The CDFS File System
        7. Networked File Systems and Mapped Volumes
        8. The DFS File System
        9. File System Compression
        10. Disk Quotas
        11. Differences in Functions Among File Systems
        12. Determining the File System and Drive Types
      2. Win32 File Objects
        1. Basic File I/O
        2. Asynchronous I/O
      3. Compatibility I/O
        1. Low-Level I/O
        2. Stream I/O
        3. The IOStream Classes
      4. Serial Communications
        1. Opening and Configuring Serial Ports
        2. Asynchronous Communications
        3. Setting Communication Timeouts
        4. Communication Events
      5. Using Consoles
        1. Allocating a Console
        2. Console I/O
        3. Customizing the Console Buffers and Display
      6. Summary
    8. 9. Using Serialization with File and Archive Objects
      1. File I/O Differences Between MFC and Win32
        1. Using Basic Win32 File I/O
        2. Using Basic MFC File I/O
      2. Working with the CFile Class
        1. Opening Files
        2. Reading and Writing from a CFile Object
      3. Using the CArchive and CObject Classes
        1. Using the CObject Class
        2. Using the CArchive Class
      4. Understanding Serialization in MFC
        1. Using the Insertion and Extraction Operators
        2. Using the Serialization Macros
          1. Declaring a Persistent Class
          2. Defining a Persistent Class
        3. Overriding the Serialize Function
        4. Creating a Serialized Collection
      5. Using Serialization with Document/View
      6. How Are Document/View Applications Serialized?
        1. Creating a Document
        2. Tracking Modifications to a Document
        3. Storing a Document
        4. Closing a Document
        5. Loading a Document
      7. Creating a Document/View Serialization Example
        1. Modifying the Document Class
        2. Creating a Dialog Box
          1. Adding a Menu Item
        3. Modifying the View
      8. Summary
  9. III. Internet Programming with MFC
    1. 10. MFC and the Internet Server API (ISAPI)
      1. Developing a Server Extension Application
        1. ISA Entry Points
        2. GetExtensionVersion()
        3. TerminateExtension()
        4. HttpExtensionProc()
        5. The Extension Control Block
          1. General Request Parameters
          2. Query Information
          3. GetServerVariable()
          4. Additional Request Data
        6. ServerSupportFunction()
          1. HSE_REQ_REFRESH_ISAPI_ACL
          2. HSE_REQ_IS_KEEP_CONN
          3. HSE_REQ_GET_IMPERSONATION_TOKEN
          4. HSE_REQ_ABORTIVE_CLOSE
          5. HSE_REQ_GET_CERT_INFO_EX
          6. HSE_REQ_SEND_URL_REDIRECT_RESP
          7. HSE_REQ_SEND_URL
          8. HSE_REQ_SEND_RESPONSE_HEADER
          9. HSE_REQ_SEND_RESPONSE_HEADER_EX
          10. HSE_REQ_MAP_URL_TO_PATH
          11. HSE_REQ_MAP_URL_TO_PATH_EX
          12. HSE_REQ_DONE_WITH_SESSION
          13. HSE_REQ_IO_COMPLETION
          14. HSE_REQ_TRANSMIT_FILE
          15. HSE_REQ_GET_SSPI_INFO
          16. HSE_APPEND_LOG_PARAMETER
          17. HSE_REQ_ASYNC_READ_CLIENT
          18. HSE_REQ_CLOSE_CONNECTION
        7. WriteClient()
        8. Sending Files
        9. Asynchronous Operations
          1. The I/O Completion Callback
        10. Writing to the Server Log
        11. Exception Handling in ISAs
        12. Debugging Your ISA
        13. Converting from CGI to ISAPI
      2. ISAPI Filters
        1. Installing a Filter
        2. ISAPI Filter Architecture
        3. GetFilterVersion()
        4. TerminateFilter()
        5. HttpFilterProc()
        6. The HTTP_FILTER_CONTEXT Structure
          1. GetServerVariable()
          2. AddResponseHeaders()
          3. WriteClient()
          4. AllocMem()
          5. ServerSupportFunction()
        7. Handling Filter Notifications
          1. SF_NOTIFY_READ_RAW_DATA
          2. SF_NOTIFY_SEND_RAW_DATA
          3. SF_NOTIFY_PREPROC_HEADERS
            1. GetHeader()
            2. SetHeader()
            3. AddHeader()
          4. SF_NOTIFY_AUTHENTICATION
          5. SF_NOTIFY_URL_MAP
          6. SF_NOTIFY_LOG
          7. SF_NOTIFY_END_OF_NET_SESSION
          8. SF_NOTIFY_ACCESS_DENIED
      3. ISAPI Support in MFC
        1. Creating ISAPI DLLs with AppWizard
        2. CHttpServer
          1. CHttpServer::GetExtensionVersion()
          2. CHttpServer::HttpExtensionProc()
          3. InitInstance()
          4. CallFunction()
          5. Parse Maps
          6. Handler Functions
          7. OnParseError()
          8. ConstructStream()
          9. StartContent()
          10. EndContent()
          11. WriteTitle()
          12. GetTitle()
          13. AddHeader()
        3. CHttpServerContext
        4. CHtmlStream
        5. CHttpFilter
        6. CHttpFilterContext
      4. The Internet Service Manager API
      5. Summary
    2. 11. The WinInet API
      1. Using the WinInet C API
        1. Handles
        2. Error Handling
        3. Passing Buffer Parameters
        4. Asynchronous I/O
      2. General Internet Functions
        1. Beginning a WinInet Session
        2. Setting Handle Options
        3. Querying Handle Options
        4. Verifying Internet Connectivity
        5. Connecting to a Server
        6. Adding a Callback Function
        7. Working with URLs
        8. Basic File Operations
        9. Querying Data Availability
        10. Reading Data
        11. Moving the File Pointer
        12. Writing to Internet Files
      3. FTP Client Functions
        1. The Current Directory
        2. Creating and Removing Directories
        3. Finding Files
        4. Retrieving a File
        5. Sending a File
        6. Opening a File on the FTP Server
        7. Other FTP File Operations
      4. HTTP Client Functions
        1. HTTP Requests
          1. Creating an HTTP Request
          2. Request Headers
          3. Sending an HTTP Request
        2. Handling HttpSendRequest() Errors
        3. Retrieving Response Information
        4. Getting Your Hands in the Cookie Jar
        5. Working with the Cache
      5. Gopher Client Functions
      6. MFC WinInet Classes
        1. CInternetSession
        2. Connection Classes
        3. File Classes
        4. CInternetException
        5. Using CInternetSession
          1. Creating a Session
          2. Retrieving a File
          3. Establishing a Connection
          4. Asynchronous Operations with CInternetSession
          5. Other CInternetSession Members
        6. Working with FTP
          1. FTP Directories
          2. Finding Files
          3. FTP Files
        7. Working with HTTP
          1. HTTP Connections
          2. HTTP Files
          3. Creating a New CHttpFile
          4. Adding HTTP Headers
          5. Sending the Request
        8. Working with Gopher
          1. Gopher Connections
          2. Gopher Locators
          3. Finding Gopher Files
          4. Working with Gopher Files
      7. Summary
    3. 12. MFC HTML Support
      1. Understanding Dynamic HTML
      2. Using the Win32 WebBrowser ActiveX Control
        1. The WebBrowser Control Architecture
          1. WebBrowser Control Properties and Methods
          2. WebBrowser Events
        2. An Example Project Using the WebBrowser Control
          1. Adding the WebBrowser ActiveX Control to an MFC Project
      3. The CHtmlView Class
        1. Navigating with CHtmlView
        2. Other Useful CHtmlView Functions
        3. Adding Dynamic HTML to Your Programs
      4. Using MFC and Dynamic HTML
        1. Simple Navigation Using CHtmlView
        2. Navigating to a Source File
        3. Navigating to the User's Home Page
        4. Using a Dynamic HTML Resource
      5. Summary
  10. IV. Advanced Programming Topics
    1. 13. Using the Standard C++ Library
      1. Standard C++ Library
      2. Standard Template Library (STL)
      3. Containers
        1. Sequence Containers
          1. The Vector Container
          2. The List Container
          3. The Deque Container
        2. Associative Containers
      4. Iterators
      5. Algorithms
        1. count()
        2. find()
        3. for_each()
        4. merge()
        5. sort()
        6. swap()
        7. Using _if: The replace_if () Algorithm
        8. Reverse Iterator
      6. Using STL with MFC and ATL
        1. Using STL with MFC
        2. Introduction to ATL
        3. ATL Versus MFC
      7. Summary
    2. 14. Error Detection and Exception Handling Techniques
      1. Structured Exception Handling
        1. The Structured Exception Method
        2. A Look at Software Exceptions
        3. A Look at Hardware Exceptions
        4. Structured Exception Handling Functions
          1. AbnormalTermination
          2. GetExceptionCode
          3. GetExceptionInformation
          4. RaiseException
            1. The ExitProcess Function
          5. SetUnhandledExceptionFilter
          6. UnhandledExceptionFilter
      2. C++ Exception Handling
        1. Using C++ Exceptions
          1. The C++ Exception Structure
          2. An Exception Example
          3. Multiple Exception Handling
          4. Using Arguments with Exceptions
        2. Exception-Handling Overhead
      3. MFC Error and Exception Handling
        1. MFC Exception Macros
          1. THROW
          2. THROW_LAST
          3. TRY
          4. CATCH
          5. AND_CATCH
          6. AND_CATCH_ALL
          7. END_CATCH
          8. END_CATCH_ALL
          9. AfxThrowArchiveException
          10. AfxThrowFileException
          11. AfxThrowMemoryException
          12. AfxThrowNotSupportedException
          13. AfxThrowResource
          14. AfxThrowResourceException
          15. AfxThrowUserException
          16. AfxThrowOleDispatchException
          17. AfxThrowOleException
          18. AfxAbort
          19. Using MFC Exception Macros with C ++ Exception Handling
        2. The Advantages of Converting from MFC Exception Macros
          1. Converting Code from MFC Macros to C++ Exception Handling
        3. Predefined Exceptions for MFC
        4. Using CFileException
        5. Using CMemoryException
        6. Using CResourceCollection
        7. Using CArchiveException
        8. Using CDaoException
        9. Using OLE Exceptions: COleException and COleDispatchException
        10. Using NotSupportedException
        11. Using CUserException
      4. Summary
    3. 15. Debugging and Profiling Strategies
      1. MFC Support for Debugging
      2. Techniques for Debugging Your MFC Application
        1. AfxDump
        2. The TRACER.EXE Utility
        3. MFC Diagnostic Features
          1. The TRACE Macro
            1. Other TRACE Macros
          2. The ASSERT Macro
          3. The ASSERT_VALID Macro
          4. Using DEBUG_NEW to Track Memory Allocation
        4. Detecting Memory Leaks
      3. Using the DevStudio IDE Debugger
        1. Compiler Warning Levels
        2. Debug Info Settings
        3. Using the Source Browser Tool
        4. Breakpoints and Single-Stepping
          1. Apply Code Changes
          2. Break Execution
          3. Go
          4. Restart
          5. Run to Cursor
          6. Step Into
          7. Step Over
          8. Step Out
          9. Stop Debugging
        5. Debugger Windows
          1. Variables Window
          2. Watch Window
          3. QuickWatch Window
          4. Registers Window
          5. Call Stack Window
          6. Disassembly Window
          7. Memory Window
      4. Using Spy++
        1. Tree View
        2. Messages View
        3. Processes View
        4. Threads View
      5. Using the OLE-COM Object Viewer
      6. Using the Process Viewer
      7. Performing Remote Debugging
      8. Troubleshooting
        1. Attaching to Running Processes
        2. Using Dr. Watson Logs
          1. Running Dr. Watson
      9. Profiling Your Application
        1. Building the Project for Function Profiling
        2. Line Profiling
        3. Profiling with PREP, PROFILE, and PLIST
          1. PREP
          2. PROFILE
          3. PLIST
      10. Summary
    4. 16. Multithreading
      1. Win32 Processes, Threads, and Synchronization
        1. Understanding Threads
        2. The Need for Synchronization
      2. Using Multiple Threads in Your Application
        1. MFC Objects and Threads
        2. Types of Threads
      3. Using Worker Threads
        1. Starting the Thread
        2. Implementing a Thread Function
        3. Accessing a Thread's Return Code
      4. Using User-Interface Threads
        1. Creating the Thread
        2. Creating a Thread Class
        3. Initializing New Threads
        4. Handling Messages in Threads
        5. Terminating Threads
        6. Thread Local Storage
          1. Allocating a TLS Index
          2. Using Thread Local Storage
      5. Thread Synchronization
        1. Potential Pitfalls
        2. CCriticalSection
        3. CMutex
        4. CSemaphore
        5. CEvent
          1. Signaling an Event
        6. CSingleLock
        7. CMultiLock
          1. CMultiLock::Lock()
          2. CMultiLock::Lock() Return Values
          3. Cleaning Up
      6. Creating a New Process
      7. Summary
    5. 17. Using Scripting and Other Tools to Automate the Visual C++ IDE
      1. The Developer Studio Object Model
        1. The Objects Exposed in Developer Studio
      2. Using VBScript to Write Developer Studio Macros
        1. Declaring Variables
        2. VBScript Subroutines
        3. Using Functions in VBScript
        4. Creating a VBScript Macro
        5. Removing a Developer Studio Macro File
        6. Example Macros Included with Visual C++
        7. Debugging a Visual Studio Macro
        8. Adding a VBScript Macro to the Toolbar
      3. Writing Developer Studio Add-Ins
        1. Using the Developer Studio Add-In Wizard
        2. The Developer Studio Add-in Architecture
        3. Adding Command-Handling Code
        4. Handling Developer Studio Events
      4. The SourceInfo Add-In
        1. Adding the Source Information Dialog Box to the Project
        2. Adding Command-Handling Code to the Project
        3. Modifying the Toolbar
        4. Using the SourceInfo Add-in
      5. Summary
  11. V. Database Programming
    1. 18. Creating Custom AppWizards
      1. How Do AppWizards Work?
      2. Creating a Custom AppWizard
        1. Starting a New AppWizard Project
          1. Creating an AppWizard from an Existing Project
          2. Creating an AppWizard from a Standard MFC AppWizard
          3. Creating a Custom AppWizard with Your Own Custom Steps
      3. Components of a Custom AppWizard Project
      4. Template Files
        1. The newproj.inf Template File
          1. Statements in newproj.inf
        2. Macros in Template Files
          1. Standard Macros
          2. User-Defined Macros
        3. Directives in Template Files
          1. Conditional Directives
          2. Loops
          3. $$INCLUDE
          4. The Default Language
        4. The confirm.inf Template File
        5. Text Templates
        6. Binary Resource Templates
          1. Creating Binary Templates
      5. Programming Your AppWizard DLL
        1. Defining Macros
        2. Creating Step Dialog Boxes
      6. Building a Custom AppWizard
      7. Debugging a Custom AppWizard
      8. Summary
    2. 19. Database Overview
      1. ODBC 4.0
      2. OLE DB and ATL's Database Classes
      3. ActiveX Data Objects (ADO)
      4. MFC's Database Classes
      5. Structured Query Language
      6. Data Definition Language
        1. Tables
          1. SQL Data Types
        2. Procedures
        3. Triggers
      7. Data Control Language
        1. Granting Privileges
        2. Revoking Privileges
      8. Data Manipulation Language
        1. SELECT Statements
          1. Expressions
          2. The LIKE Predicate
          3. The IN Predicate
          4. The BETWEEN Predicate
          5. Aggregate Functions
          6. ODBC SQL Literal Values
          7. SQL Functions
          8. Joins
          9. Correlation Names
          10. Outer Joins
          11. Subqueries
          12. Union Queries
        2. INSERT Statements
        3. DELETE Statements
        4. UPDATE Statements
      9. Summary
    3. 20. ODBC Programming
      1. ODBC Architecture
        1. ODBC Drivers
          1. Core API Conformance
          2. Extension Level 1 Conformance
          3. Extension Level 2 Conformance
          4. SQL Grammar Conformance
        2. ODBC Driver Manager
        3. Data Sources
        4. ODBC Data Source Administrator
          1. Adding a Data Source
        5. ODBC Installation and Setup Programming
      2. ODBC API Basics
        1. ODBC Handles
        2. ODBC Data Types
      3. Creating ODBC Applications
        1. Allocating and Freeing ODBC Handles
          1. Setting Your Application's ODBC Version
          2. Allocating a Connection Handle
          3. Connection Options
          4. Starting Development on an ODBC Program
            1. Step 1
            2. Step 2
            3. Step 3
            4. Step 4
            5. Step 5
            6. Step 6
        2. ODBC Error Handling
          1. SQLRETURN Values
          2. Diagnostic Records
          3. SQLGetDiagField()
            1. Header Record Fields
            2. Status Record Fields
          4. SQLSTATES
          5. SQLGetDiagRec()
          6. Writing an ODBC Error Handling Routine
        3. Connecting to a Data Source
          1. SQLConnect()
          2. Writing a Program to Connect to a Database
        4. SQLDriverConnect()
        5. SQLBrowseConnect()
        6. SQLDataSources()
        7. Retrieving Connection Information
      4. Executing SQL Statements
        1. Statement Handles
        2. SQLExecDirect()
        3. Prepared SQL Statements
        4. SQLExecute()
        5. Working with Parameters
          1. SQLBindParameter()
            1. Parameter Arrays
            2. Row-Wise Binding
          2. Passing Parameter Data at Execution Time
          3. Parameter Information
      5. Working with Result Sets
        1. Binding Columns
        2. SQLBindCol()
        3. SQLFetch()
          1. Multiple Result Sets
        4. Closing the Cursor
        5. Reusing Statement Handles
        6. SQLGetData()
        7. Column Information
          1. SQLDescribeCol()
          2. SQLColAttribute()
      6. Retrieving More Than One Row at a Time
        1. Block Cursors
        2. Scrollable Cursors
        3. The ODBC Cursor Library
        4. Using Block Cursors
          1. Setting the Size of a Rowset
          2. Binding Columns for a Rowset
            1. Column-Wise Binding
            2. Row-Wise Binding
          3. Calling SQLFetch() for Block Cursors
          4. Row Status Information
          5. Block Cursors and Single-Row Functions
        5. Using Scrollable Cursors
          1. Cursor Support
          2. Setting the Cursor Type
          3. Calling SQLFetchScroll()
          4. Using Bookmarks
      7. Inserting, Updating, and Deleting Rows
        1. Positioned Updates and Deletions
        2. SQLBulkOperations()
          1. Inserting with SQLBulkOperations()
          2. Updating with SQLBulkOperations()
          3. Deleting with SQLBulkOperations()
          4. Fetching with SQLBulkOperations()
      8. Asynchronous Operations
      9. Transactions
        1. ODBC Commit Modes
          1. Auto-Commit Mode
          2. Manual-Commit Mode
        2. Transaction Isolation Levels
        3. Cursor Concurrency Types
      10. Catalog Functions
      11. Summary
    4. 21. MFC Database Classes
      1. Using the AppWizard to Generate MFC Classes
        1. Step 1
        2. Step 2
        3. Step 3
        4. Step 4
        5. Step 5
        6. Step 6
        7. Step 7
      2. The CRecordset Class
        1. Record Field Exchange
        2. GetFieldValue()
        3. Refreshing the Recordset
        4. Moving About in the Recordset
          1. Moving Forward
          2. Scrolling
          3. Using Bookmarks
          4. CRecordset::Move()
        5. Changing Data in a Recordset
          1. Deleting a Row
          2. Adding a New Row
          3. Editing an Existing Row
            1. Working with NULL Values
            2. Row Locking
          4. Using Statement Parameters
      3. The CRecordView Class
        1. Dialog Data Exchange with CRecordView
        2. OnGetRecordset()
        3. CRecordView::OnMove()
      4. The CDatabase Class
        1. Executing SQL Statements with CDatabase
          1. OnSetOptions()
        2. Transactions with CDatabase
          1. Effects of Transactions on CRecordsets
        3. Using the ODBC API Directly
      5. Exception Handling
      6. Bulk Row Operations
        1. Opening a CRecordset for Bulk RFX
        2. Implementing Bulk Record Field Exchange
          1. DoBulkFieldExchange()
        3. Fetching Bulk Records
          1. CheckRowsetError()
        4. Using Single-Row Functions
      7. Summary
    5. 22. Using OLE DB
      1. OLE DB Architecture
      2. Developing an OLE DB Application
        1. Adding an ATL OLE DB Consumer Object
        2. Consumer Components
          1. CRowset
          2. CAccessor and CAccessorRowset
          3. CCommand
        3. Data Source Properties
          1. CCommand Properties
        4. Using a Consumer
        5. Opening and Closing a Rowset
          1. Updating and Inserting into Rowsets
          2. Navigating Through a Rowset
          3. Deleting Rows from a Rowset
        6. Catching OLE DB Errors
      3. Retrieving Column Information
        1. GetColumnInfo()
        2. DBCOLUMNINFO
        3. GetColumnsRowset()
      4. Using Transactions
      5. Using Enumerators
      6. Summary
    6. 23. Programming with ADO
      1. ADO Objects
      2. Connection Objects
        1. ADOConnection Properties
        2. ADOConnection Methods
      3. ADOCommand Objects
        1. ADOCommand Properties
        2. ADOCommand Methods
      4. ADORecordset Objects
        1. ADORecordset Properties
        2. ADORecordset Methods
      5. ADOFields Collections and ADOField Objects
        1. ADOFields Collection Members
        2. ADOField Object Properties
        3. ADOField Object Methods
      6. ADOParameter Objects and the ADOParameters Collection
        1. ADOParameters Collection Members
        2. ADOParameter Object Properties
        3. ADOParameter Object Methods
      7. ADOProperty Objects and ADOProperties Collections
        1. ADOProperties Collection Members
        2. ADOProperty Object Properties
      8. Writing a Visual C++ ADO Application
        1. Step 1—Creating Connections and Recordsets ADO Objects
        2. Step 2—Connecting to a Database Through ADO
        3. Step 3—Opening an ADO Recordset
        4. Step 4—Closing the Connection and Recordset
        5. Step 5—Writing an UpdateData Routine for ADO
          1. Step 5a—Retrieving Recordset Field Information
          2. Step 5b—Updating Recordset Field Information
          3. Step 5c—Pulling It Together in One UpdateData() Routine
        6. Step 6—Navigating Through a Recordset
        7. Step 7—Inserting into the Recordset
        8. Step 8—Deleting from the Recordset
      9. Processing ADO Errors
        1. ADO HRESULT Values, FAILED, and SUCCEEDED
        2. ADOErrors Collection Members
        3. Error Object Properties
        4. ADO C++ Exceptions
        5. The Errors Collection
      10. Enhanced ADO Recordset Functionality
        1. Limiting the Rows in a Recordset
        2. Filtering Rows in the Recordset
        3. Refreshing the Recordset
        4. Move()
        5. Absolute Positioning
        6. Scrolling by Pages
        7. Using Bookmarks
      11. Executing Commands
      12. Transactions
      13. Summary
  12. VI. MFC Support for COM and ActiveX
    1. 24. Overview of COM and Active Technologies
      1. COM, OLE, and Active Technology History in a Nutshell
      2. COM and OLE from the Eyes of the End User
      3. COM, OLE, and Active Technologies from a Programmer's View
        1. Component Object Model (COM)
        2. Structured Storage
        3. Monikers (Persistent Naming)
          1. File Monikers
          2. Item Monikers
          3. Anti-Monikers
          4. Pointer Monikers
          5. Class Monikers
          6. Asynchronous Monikers
          7. URL Monikers
          8. Composite Monikers
          9. MFC Encapsulation of Monikers
        4. Uniform Data Transfer (UDT)
          1. OLE Clipboard
          2. Drag and Drop
          3. Embedding and Linking
        5. OLE Documents
          1. In-Place Activation
        6. Automation
        7. ActiveX Controls
      4. Evolving OLE with Active Technologies
        1. Active Documents
          1. Asynchronous Storage
        2. ActiveX Controls
          1. ActiveX Control: COM
          2. ActiveX Control: Connectable Objects
          3. ActiveX Control: Uniform Data Transfer
          4. ActiveX Control: Compound Documents
          5. ActiveX Control: Property Pages
          6. ActiveX Control: Automation
          7. ActiveX Control: Persistent Storage
        3. COM
          1. Distributed COM (DCOM)
        4. Internet Monikers
          1. URL Monikers
          2. Asynchronous Monikers
      5. New Active Technologies
        1. Active Hyperlinks
        2. NetShow
        3. Active Scripting
        4. Code Signing
        5. HTML Extensions
        6. ActiveMovie
      6. Summary
    2. 25. Active Documents
      1. Just What Is an Active Document?
      2. Some Details About Active Documents
      3. The COM Interfaces
        1. IOleObject
        2. IDataObject
        3. IPersistStorage
        4. IPersistFile (Optional)
        5. IOleDocument
        6. IOleInPlaceObject
        7. IOleInPlaceActiveObject
        8. IOleDocumentView
        9. IPrint
        10. IOleCommandTarget
      4. The Active Template Library
        1. ATL Classes Required for Active Document Support
      5. The ACTIVEDOC Program
        1. activectl.h
        2. oledocument.h
        3. activedoc.htm
      6. Summary
    3. 26. Active Containers
      1. Just What Is an Active Document Container?
      2. Some Details About Active Document Containers
        1. Structured Storage
        2. Monikers
        3. Uniform Data Transfer
        4. Embedded Objects
        5. Linked Objects
        6. Drag-and-Drop
        7. In-Place Activation
        8. Active Documents
      3. The COM Interfaces
        1. IOleInPlaceFrame
        2. IOleCommandTarget
        3. IOleInPlaceUIWindow
        4. IOleContainer
        5. IOleClientSite
        6. IAdviseSink
        7. IOleDocumentSite
        8. IOleInPlaceSite
        9. IContinueCallback
      4. Building an Active Document Container
        1. Active Document Container Support in MFC
        2. The Pocket Project
        3. Creating the Pocket Project
          1. Using MFC AppWizard to Create the Project
          2. Adding a Splitter to the Pocket Project
          3. Creating New Active Documents
          4. Switching Between Active Documents
          5. Destroying an Active Document
          6. Using the Pocket Application
      5. Summary
    4. 27. Active Servers
      1. Active Servers Introduction
      2. Three-Tier Development Using Server Components
      3. MFC Versus Active Template Libraries
      4. Designing an MFC Miniserver
        1. AppWizard: Step-by-Step
          1. Step 1 of 6
          2. Step 2 of 6
          3. Step 3 of 6
          4. Step 4 of 6
          5. Step 5 of 6
          6. Step 6 of 6
        2. A Closer Look at the GLServer Classes
          1. CGLServerApp
          2. CGLServerDoc
          3. CGLServerSrvrItem
          4. CInPlaceFrame
          5. CGLServerView
        3. Combining Container and Server Menus During Activation
        4. Testing Out the GLServer Skeleton
        5. Adding Customization to the GLServer Skeleton
          1. Customizing CGLServerDoc
          2. Customizing CGLServerView
          3. Customizing CGLServerSrvrItem
        6. Testing the GLServer Example
      5. Designing an MFC Automation Server
        1. Using MFC AppWizard to Create Automation Servers
        2. A Closer Look at the MFCAuto Classes
        3. Adding Customization to the MFCAuto Sample Skeleton
          1. Adding Methods to the MFCAuto Example
        4. Testing the MFCAuto Example
      6. Summary
    5. 28. ActiveX Controls
      1. A Short History
      2. What Is an ActiveX Control?
      3. ActiveX Control Architecture
        1. Properties
        2. Events
        3. Methods
      4. ActiveX Control Interfaces
      5. ActiveX Controls
        1. Supporting the IUnknown Interface
        2. A Control Must Be Self-Registering
        3. Component Categories
          1. Simple Frame Site Containment
          2. Simple Data Binding
          3. Advanced Data Binding
          4. Visual Basic Private Interfaces
          5. Internet-Aware Controls
          6. Windowless Controls
        4. Component Categories and Interoperability
        5. Code Signing
        6. Performance Considerations
          1. Optimize Control Drawing
          2. Don't Always Activate Your Control When It Is Visible
          3. Provide Flicker-Free Activation
          4. Optimize Persistence and Initialization
          5. Use Windowless Controls
          6. Use a Device Context That Is Unclipped
          7. While a Control Is Inactive, Provide Mouse Interaction
      6. Reinventing the Wheel
        1. Visual C++ ActiveX Controls
      7. Testing an ActiveX Control
        1. Displaying a Control on a Web Page
        2. ActiveX Control Pad
        3. ActiveX Control Test Container
        4. ActiveX Controls in Development Tools
      8. Methods of Creating ActiveX Controls
      9. Creating an ActiveX Control with Visual C++ and MFC
        1. Using Visual C++ and MFC for ActiveX Controls
        2. MFC Encapsulation of ActiveX and ActiveX Controls
          1. The MFC ActiveX ControlWizard
      10. Summary
  13. VII. Using the Active Template Library
    1. 29. ATL Architecture
      1. The History of ATL
      2. ATL's Advanced Use of Templates
      3. Commonly Used ATL Classes
        1. High-Level ATL Classes
        2. ATL Helper Classes
          1. Using CRegKey to Access the Registry
          2. Using CComBstr to Manage COM Strings
          3. Using the CComVariant Class
          4. Using Smart Pointers
      4. Using the Interface Definition Language
      5. ATL Wizards
        1. Using the ATL COM AppWizard
        2. Using the ATL Object Wizard
        3. Merging the Proxy/Stub Code with Your DLL
      6. Summary
    2. 30. Creating COM Objects Using ATL
      1. Using IDL to Describe Custom COM Objects
        1. Understanding MIDL Attributes
        2. Compiling an IDL Source File with MIDL
        3. Using Type Libraries
        4. Using Structures in IDL
        5. Using Enumerations in IDL
        6. Pointers in IDL
        7. Using Direction Attributes in IDL
      2. A Custom COM Class Example
        1. Defining the IOsVersion Interface
        2. Modifications to the COsVersion Declaration
        3. Implementing the COsVersion Class
        4. Compiling and Registering the Standard Proxy/Stub DLL
        5. Creating Test Clients for OsVersionInfo
      3. Summary
    3. 31. Creating ActiveX Controls Using ATL
      1. ATL Control Classes
        1. Implementing Stock Properties Using ATL
        2. Implementing Custom Properties Using ATL
        3. Using Ambient Properties with ATL
        4. Adding Message and Event Handlers
      2. Connection Points
      3. Creating Scriptable Controls
        1. Requirements for Scriptable Controls
        2. Persistence for ActiveX Controls
        3. A Scriptable ActiveX Control
          1. The Basic Design of ScriptButton
          2. Messages Handled by ScriptButton
          3. Handling Raised-Button and Flat-Button States
          4. Handling Button Clicks
          5. Handling the Focus Rectangle
          6. Creating the ScrBtn Project
          7. Adding the ScriptButton Control Class to the Project
          8. Adding Outgoing Events
          9. Modifying the Message Map
          10. Initializing the CScriptButton Object
          11. Retrieving Ambient Properties
          12. Handling Focus Events for the Control
          13. Handling Mouse Events for the Control
          14. Drawing the Control
          15. Implementing IPersistPropertyBag
          16. Marking the Control as Safe for Scriptable Clients
          17. Testing ScriptButton with Internet Explorer
      4. Summary
    4. 32. Using ATL to Create MTS and COM+ Components
      1. Understanding Transactions
      2. COM+ and MTS Features
        1. Understanding Contexts
        2. Concurrency in COM+
        3. Just-In-Time Activation
        4. What Is Object Pooling?
        5. Registering a COM+ Application
        6. Configuring Properties for a COM+ Application
        7. Registering a COM+ Component
        8. Configuring Properties for a COM+ Component
          1. General Properties
          2. Transactions Properties
          3. Security Properties
          4. Activation Properties
          5. Concurrency Properties
          6. Advanced Properties
      3. An Example of a COM+ Application
        1. The VcBank Database
        2. Creating the VCBankApp COM+ Module
          1. Inserting the VcBank COM+ Component
          2. Adding Interface Methods to the VcBank Component
          3. Changes to StdAfx.h
          4. Changes to VcBank.h
          5. Adding Helper Functions to VcBank.cpp
          6. Implementing the VcBank Interface Methods
        3. Registering the VcBank COM+ Application
        4. A Client Application for VcBank
          1. Adding Dialog Boxes to the BankClient Project
          2. Modifying the Main Dialog Box for BankClient
          3. Accessing the COM+ Application
          4. Retrieving an Account Balance
          5. Making a Deposit
          6. Making a Withdrawal
          7. Transferring Money Between Accounts
          8. Using BankClient
      4. Summary
  14. VIII. Finishing Touches
    1. 33. Adding Windows Help
      1. Windows Help Basics
        1. Understanding WinHelp
        2. Understanding HTML Help
      2. Help Options in AppWizard
      3. Help Project Components
      4. Authoring Help Topics Using WinHelp
        1. Creating Help Topics
        2. Adding Hot Spots
        3. Including Graphics in Help Files
      5. Managing Help Projects
        1. Help Project Files
        2. Contents Files
        3. Compiling Help Projects
        4. Testing Help Projects
      6. Calling WinHelp from Your Applications
        1. ::WinHelp()
        2. Using Help with MFC
          1. CWinApp::WinHelp()
          2. MFC Help Handlers
      7. Adding Context-Sensitive Help
      8. Using HTML Help with Visual C++
        1. Creating an HTML Help Project
          1. Using HTML Help Workshop to Create a Project
          2. Creating Topic Pages
          3. Create an Index File for Help Topics
          4. Creating a Table of Contents
          5. Compiling an HTML Help Project
        2. Integrating HTML into a Visual C++ Project
          1. Modifications Required in the HTML Help Project
          2. Modifications Required in the Visual C++ Project
      9. Summary
  15. IX. Appendix
    1. A. Additional Resources
      1. Visual C++ Resources
        1. Microsoft Developer's Network
          1. Library Subscription
          2. Professional Subscription
          3. Universal Subscription
        2. Hard-Copy Visual C++ Documentation
        3. Magazines and Journals
        4. Conferences
        5. Software
        6. Books on Visual C++, MFC, and Windows Programming
          1. Bibliography
        7. Internet
        8. Newsgroups and FAQs
      2. Summary

Product information

  • Title: Visual C++® 6 Unleashed
  • Author(s):
  • Release date: July 2000
  • Publisher(s): Sams
  • ISBN: 9780672312410