You are previewing Microsoft Visual C++ Windows Applications by Example: Code and Explanation for Real-World MFC C++ Applications.
O'Reilly logo
Microsoft Visual C++ Windows Applications by Example: Code and Explanation for Real-World MFC C++ Applications

Book Description

In Detail

With this book you will learn how to create applications using MDI, complex file formats, text parsing and processing, graphics, and interactions. Every essential skill required to build Windows desktop–style applications is covered in the context of fully working examples.

The book begins with a quick primer on the C++ language, and using the Visual C++ IDE to create Windows applications. This acts as a recap for existing C++ programmers, and a quick guide to the language if you've not worked with C++ before. The book then moves into a set of comprehensive example applications, presenting the important parts of the code with explanation of how it works, and how and when to use similar techniques in your own applications.

The applications include: a Tetris-style game, a drawing application, a spreadsheet, and a word processor.

If you know the C++ language, or another Windows-based programming language, and want to use C++ to write real, complex applications then this book is ideal for you.

What you will learn from this book?

When you read this book, you will learn to:

  • Build larger, more powerful, user friendly C++ applications

  • Create MDI (multiple document interface) applications and use other Windows application interface elements

  • Create memory structures for complex application objects: documents, spreadsheets, drawings

  • Save files to represent these memory structures

  • Parse and process text, display interactive graphics, and handle input from the mouse and the keyboard

Who this book is written for?

The book is ideal for programmers who have worked with C++ or other Windows-based programming languages. It provides developers with everything they need to build complex desktop applications using C++.

If you have already learned the C++ language, and want to take your programming to the next level, then this book is ideal for you.

Table of Contents

  1. Microsoft Visual C++ Windows Applications by Example
  2. Credits
  3. About the Author
  4. About the Reviewer
  5. Preface
    1. What you need for this book
    2. Who this book is for
    3. Conventions
    4. Reader Feedback
      1. Customer Support
      2. Downloading the Example Code for the Book
      3. Errata
      4. Questions
  6. 1. Introduction to C++
    1. The Compiler and the Linker
    2. The First Program
    3. Comments
    4. Types and Variables
      1. Simple Types
      2. Variables
      3. Constants
      4. Input and Output
      5. Enumerations
      6. Arrays
      7. Pointers and References
      8. Pointers and Dynamic Memory
      9. Defining Our Own Types
      10. The Size and Limits of Types
      11. Hungarian Notation
    5. Expressions and Operators
      1. Arithmetic Operators
      2. Pointer Arithmetic
      3. Increment and Decrement
      4. Relational Operators
      5. Logical Operators
      6. Bitwise Operators
      7. Assignment
      8. The Condition Operator
      9. Precedence and Associativity
    6. Statements
      1. Selection Statements
      2. Iteration Statements
      3. Jump Statements
      4. Expression Statements
    7. Functions
      1. Void Functions
      2. Local and Global Variables
      3. Call-by-Value and Call-by-Reference
      4. Default Parameters
      5. Overloading
      6. Static Variables
      7. Recursion
      8. Definition and Declaration
      9. Higher Order Functions
      10. The main() Function
    8. The Preprocessor
    9. The ASCII Table
    10. Summary
  7. 2. Object-Oriented Programming in C++
    1. The Object-Oriented Model
    2. Classes
      1. The First Example
        1. Car.h
        2. Car.cpp
        3. Main.cpp
      2. The Second Example
        1. BankAccount.h
        2. BankAccount.cpp
        3. Main.cpp
    3. Inheritance
      1. Person.h
      2. Person.cpp
      3. Student.h
      4. Student.cpp
      5. Employee.h
      6. Employee.cpp
    4. Dynamic Binding
      1. Main.cpp
      2. Person.h
      3. Person.cpp
      4. Student.h
      5. Student.cpp
      6. Employee.h
      7. Employee.cpp
      8. Main.cpp
    5. Arrays of Objects
    6. Pointers and Linked Lists
      1. Stacks and Linked Lists
        1. Cell.h
        2. Cell.cpp
        3. Main.cpp
        4. Stack.h
        5. Stack.cpp
        6. Main.cpp
    7. Operator Overloading
      1. Rational.h
      2. Rational.cpp
      3. Main.cpp
    8. Exceptions
      1. Exception.cpp
    9. Templates
      1. TemplateCell.h
      2. TemplateStack.h
      3. Main.cpp
    10. Namespaces
    11. Streams and File Processing
      1. TextStream.cpp
      2. Input.txt
      3. Output.txt
      4. BinaryStreams.cpp
    12. Summary
  8. 3. Windows Development
    1. Visual Studio
    2. The Document/View Model
    3. The Message System
    4. The Coordinate System
    5. The Device Context
    6. The Registry
    7. The Cursor
    8. Serialization
    9. Summary
  9. 4. Ring: A Demonstration Example
    1. The Application Wizard
    2. Colors and Arrays
      1. RingDoc.h
    3. Catching the Mouse
      1. RingView.cpp
      2. RingView.cpp
      3. RingDoc.h
      4. RingDoc.cpp
    4. Drawing the Rings
      1. RingView.cpp
    5. Setting the Coordinate System and the Scroll Bars
      1. RingView.cpp
      2. RingView.cpp
      3. RingView.cpp
      4. RingDoc.h
      5. RingView.cpp
    6. Catching the Keyboard Input
      1. RingView.cpp
    7. Menus, Accelerators, and Toolbars
      1. RingDoc.h
      2. RingDoc.cpp
      3. RingDoc.cpp
      4. RingDoc.cpp
    8. The Color Dialog
      1. RingDoc.cpp
    9. The Registry
      1. RingDoc.cpp
    10. Serialization
      1. RingDoc.cpp
      2. RingDoc.cpp
    11. Summary
  10. 5. Utility Classes
    1. The Point, Size, and Rectangle Classes
    2. The Color Class
      1. Color.h
      2. Color.cpp
    3. The Font Class
      1. Font.h
      2. Font.cpp
    4. The Caret Class
      1. Caret.h
      2. Caret.cpp
    5. The List Class
      1. List.h
    6. The Set Class
      1. Set.h
      2. Set.cpp
      3. Set.h
    7. The Array Class
    8. Error Handling
      1. Check.h
      2. Check.h
    9. Summary
  11. 6. The Tetris Application
    1. The Tetris Files
      1. The Square Class
        1. Square.h
      2. The Color Grid Class
        1. ColorGrid.h
        2. ColorGrid.cpp
      3. The Document Class
        1. TetrisDoc.h
        2. TetrisDoc.cpp
      4. Th e View Class
        1. TetrisView.h
        2. TetrisView.cpp
    2. The Figure Class
      1. Figure.h
      2. Figure.cpp
    3. The Figure Information
      1. FigureInfo.cpp
      2. The Red Figure
      3. The Brown Figure
      4. The Turquoise Figure
      5. The Green Figure
      6. The Yellow Figure
      7. The Blue Figure
      8. The Purple Figure
    4. Summary
  12. 7. The Draw Application
    1. Draw.cpp
    2. The Resource
    3. The Class Hierarchy
    4. The Figure Class
      1. Figure.h
      2. Figure.cpp
    5. The TwoDimensionalFigure Class
      1. TwoDimensionalFigure.h
      2. TwoDimensionalFigure.cpp
    6. The LineFigure Class
      1. LineFigure.h
      2. L ineFigure.cpp
      3. Line Figure.cpp
      4. LineFigure.cpp
    7. The ArrowFigure Class
      1. ArrowFigure.h
      2. ArrowFigure.cpp
    8. The RectangleFigure Class
      1. RectangleFigure.h
      2. RectangleFigure.cpp
      3. RectangleFigure.cpp
    9. The Ell ipseFigure Class
      1. EllipseFigure.h
      2. EllipseFigure.cpp
    10. The TextFigure Class
      1. TextFigure.h
      2. TextFigure.cpp
    11. The FigureFileManager Class
      1. FigureFileManager.h
      2. FigureFileManager.cpp
    12. The Document Class
      1. DrawDoc.h
      2. DrawDoc.cpp
    13. The View Class
      1. DrawView.h
      2. CDrawView.cpp
    14. Summary
  13. 8. The Calc Application
    1. Calc.cpp
    2. The Resource
    3. Formula Interpretation
      1. The Tokens
        1. Token.h
      2. The Reference Class
        1. Reference.h
        2. Reference.cpp
      3. The Scanner—Generating the List of Tokens
        1. Scanner.h
        2. Scanner.cpp
      4. The Parser—Generating the Syntax Tree
        1. Parser.h
        2. Parser.cpp
      5. The Syntax Tree—Representing the Formula
        1. SyntaxTree.h
        2. SyntaxTree.cpp
    4. The Spreadsheet
      1. The Cell—Holding Text, Value, or Formula
        1. Cell.h
        2. Cell.cpp
      2. The Cell Matrix—Managing Rows and Columns
        1. CellMatrix.h
        2. CellMatrix.cpp
      3. The Target Set Matrix Class
        1. TSetMatrix.h
        2. TSetMatrix.cpp
    5. The Document/View Model
      1. The Document Class
        1. CalcDoc.h
        2. CalcDoc.cpp
      2. The View Class
        1. CalcView.h
        2. CalcView.cpp
    6. Summary
  14. 9. The Word Application
    1. Word.cpp
    2. The Resource
      1. The Line
        1. Line.h
        2. Line.cpp
      2. The Position
        1. Position.h
        2. Position.cpp
      3. The Paragraph
        1. Paragraph.h
        2. Paragraph.cpp
    3. The Page
      1. Page.h
      2. Page.cpp
    4. The Document Class
      1. WordDoc.h
      2. CWordDoc.cpp
    5. The View Class
      1. WordView.h
      2. CWordView.cpp
    6. Summary