C++ Windows Programming

Book description

Develop real-world applications in Windows

About This Book

  • Create diverse applications featuring the versatility of Small Windows C++ library

  • Learn about object-oriented programming in Windows and how to develop a large object-oriented class library in C++

  • Understand how to tackle application-specific problems along with acquiring a deep understanding of the workings of Windows architecture

  • Who This Book Is For

    This book is for application developers who want a head-first approach into Windows programming. It will teach you how to develop an object-oriented class library in C++ and enhanced applications in Windows. Basic knowledge of C++ and the object-oriented framework is assumed to get the most out of this book.

    What You Will Learn

  • Develop advanced real-world applications in Windows

  • Design and implement a graphical object-oriented class library in C++

  • Get to grips with the workings of the integral aspects of the Win32 API, such as mouse input, drawing, cut-and-paste, file handling, and drop files

  • Identify general problems when developing graphical applications as well as specific problems regarding drawing, spreadsheet, and word processing applications

  • Implement classes, functions, and macros of the object-oriented class library developed in the book and how we implement its functionality by calling functions and macros in the Win32 API

  • In Detail

    It is critical that modern developers have the right tools to build practical, user-friendly, and efficient applications in order to compete in today’s market. Through hands-on guidance, this book illustrates and demonstrates C++ best practices and the Small Windows object-oriented class library to ease your development of interactive Windows applications.

    Begin with a focus on high level application development using Small Windows. Learn how to build four real-world applications which focus on the general problems faced when developing graphical applications. Get essential troubleshooting guidance on drawing, spreadsheet, and word processing applications. Finally finish up with a deep dive into the workings of the Small Windows class library, which will give you all the insights you need to build your own object-oriented class library in C++.

    Style and approach

    This book takes a tutorial-style approach that will demonstrate the features of a C++ object-oriented library by developing interactive Windows applications.

    Table of contents

    1. C++ Windows Programming
      1. C++ Windows Programming
      2. Credits
      3. About the Author
      4. About the Reviewer
      5. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      6. Dedication
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Introduction
        1. The library
        2. Summary
      9. 2. Hello, Small World!
        1. Hello, Small Windows!
        2. The circle application
          1. The main window
          2. The CircleDocument class
          3. The Circle class
        3. Summary
      10. 3. Building a Tetris Application
        1. The MainWindow function
        2. The Tetris window
          1. Keyboard input
          2. Drawing
          3. Input focus
          4. The timer
          5. New figures
          6. Game over
          7. New game
          8. Deleting and flashing rows
          9. Closing the window
        3. The TetrisFigure class
          1. The red figure
          2. The brown figure
          3. The turquoise figure
          4. The green figure
          5. The yellow figure
          6. The blue figure
          7. The purple figure
        4. The GameGrid class
          1. Invalidating and drawing squares
        5. Summary
      11. 4. Working with Shapes and Figures
        1. The MainWindow function
        2. The DrawDocument class
          1. The application modes
          2. The DynamicList class
          3. Initialization
          4. Mouse input
          5. Painting
          6. The File menu
          7. Cut, copy, and paste
          8. The Modify menu
          9. The Add menu
          10. The cursor
        3. Summary
      12. 5. The Figure Hierarchy
        1. The DrawFigure class
        2. The LineFigure class
        3. The ArrowFigure class
        4. The RectangleFigure class
        5. The EllipseFigure class
        6. Summary
      13. 6. Building a Word Processor
        1. Auxiliary classes
          1. Character information
          2. Line information
          3. The Paragraph class
        2. The MainWindow class
        3. The WordDocument class
          1. The caret
          2. Mouse input
          3. Touchscreen
          4. Page setup and calculation
          5. Painting and drawing
          6. File management
          7. Cut, copy, and paste
          8. Delete
          9. Page break
          10. Font
          11. Alignment
        4. Summary
      14. 7. Keyboard Input and Character Calculation
        1. Keyboard handling
          1. Arrow keys
          2. Home and End
          3. Shift arrow keys
          4. Shift Page Up and Page Down
          5. Shift Home and End
          6. Control Home and End
          7. Shift Control Home and End
          8. Neutral keys
          9. Visible characters
        2. Character calculation
          1. Character size and ascent line
          2. Line generation
          3. Regular and justified rectangle list generation
          4. Invalidate rectangle set generation
        3. Summary
      15. 8. Building a Spreadsheet Application
        1. The MainWindow class
        2. The CalcDocument class
          1. Mouse input
          2. Scrolling and marking
          3. Painting
          4. Visibility
          5. Marking and updating
          6. Keyboard input
          7. File management
          8. Cut, copy, and paste
          9. Font and color
          10. Alignment
        3. Source and target sets
        4. Graph searching
        5. Error handling
        6. Summary
      16. 9. Formula Interpretation
        1. Formula interpretation
          1. The tokens
          2. The tree node
          3. The Scanner – Generating the list of tokens
          4. The parser – Generating the syntax tree
        2. Matrix and reference
          1. The reference class
          2. The Matrix class
        3. The cell
          1. Character input
          2. Drawing
          3. Caret rectangle list generation
          4. Formula interpretation
          5. File management
        4. Further reading
        5. Summary
      17. 10. The Framework
        1. An overview of Small Windows
        2. "Hello" window for the Win32 API
        3. The MainWindow function
        4. The WinMain function
        5. The Application class
          1. The Win32 API Windows classes
          2. The message loop
        6. The Window class
          1. Initialization
          2. Header and visibility
          3. The touch screen
          4. Invalidation and window updates
          5. Preparing the device context
          6. Unit transformation
          7. Window size and position
          8. Text metrics
          9. Closing the window
          10. The MessageBox method
        7. The Graphics class
        8. Summary
      18. 11. The Document
        1. The Document class
          1. Initialization
          2. The Document header
          3. The caret
          4. The mouse wheel
          5. The menu bar
          6. The scroll bar
          7. The DocumentProc method
        2. The Menu class
        3. The Accelerator class
        4. The StandardDocument class
          1. Initialization
          2. Standard menus
          3. File management
          4. Cut, copy, and paste
          5. Drop files
          6. Page size
          7. Page setup
          8. Printing
        5. Summary
      19. 12. The Auxiliary Classes
        1. The Size class
        2. The Point class
        3. The Rect class
        4. The Color class
        5. The Font class
        6. The Cursor class
        7. The DynamicList class
        8. The Tree class
        9. The InfoList class
        10. Strings
        11. Summary
      20. 13. The Registry, Clipboard, Standard Dialogs, and Print Preview
        1. The registry
        2. The Clipboard class
          1. ASCII and Unicode lines
          2. Generic information
        3. Standard dialogs
          1. The Save dialog
          2. The Open dialog
          3. The Color dialog
          4. The Font dialog
          5. The Print dialog
        4. Print preview
          1. Keyboard input
          2. Scroll bar
        5. Summary
      21. 14. Dialogs, Controls, and Page Setup
        1. Custom dialogs
        2. Controls
          1. The button controls
          2. List controls
          3. Combo box
          4. Label
          5. The TextField class
        3. Converters
          1. Signed integers
          2. Unsigned integers
          3. Double values
          4. Strings
          5. Rational numbers
          6. Complex numbers
        4. Page setup
          1. Page setup information
          2. The Page Setup dialog
          3. The Template function
        5. Summary
      22. A. Rational and Complex Numbers
        1. Rational numbers
        2. Complex numbers
        3. Summary

    Product information

    • Title: C++ Windows Programming
    • Author(s): Stefan Björnander
    • Release date: September 2016
    • Publisher(s): Packt Publishing
    • ISBN: 9781786464224