Book Image

C++ Windows Programming

By : Stefan Björnander
Book Image

C++ Windows Programming

By: Stefan Björnander

Overview of this book

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++.
Table of Contents (22 chapters)
C++ Windows Programming
Credits
About the Author
About the Reviewer
www.PacktPub.com
Dedication
Preface
Free Chapter
1
Introduction

The Cursor class


There is a set of cursors available in the Win32 API, all with names starting with IDC_. In Small Windows, they have been given other names, which are hopefully easier to understand. Unlike other cases, we cannot use an enumeration for the cursors, since they are actually zero-terminated C++ strings (character pointers). Instead, every cursor is a pointer to a zero-terminated string. LPCTSTR stands for Long Pointer to Constant TChar String.

The reason the cursor has its own class, while the caret has a method in the Document class is that the caret does need a window handle to be set, while the cursor does not.

Cursor.h

namespace SmallWindows { 
  typedef LPCTSTR CursorType; 
 
  class Cursor { 
    public: 
      static const CursorType Normal; 
      static const CursorType Arrow; 
      static const CursorType ArrowHourGlass; 
      static const CursorType Crosshair; 
      static const CursorType Hand; 
      static const...