Book Image

Microsoft Visual C++ Windows Applications by Example

By : Stefan Bjornander, Stefan Björnander
Book Image

Microsoft Visual C++ Windows Applications by Example

By: Stefan Bjornander, Stefan Björnander

Overview of this book

Table of Contents (15 chapters)
Microsoft Visual C++ Windows Applications by Example
Credits
About the Author
About the Reviewer
Preface
Index

The Cursor


The message WM_CURSOR is sent to the view class when the application is in idle mode (not busy with anything else). The answer to the message is handled to the preferred cursor. There are a number of standard cursors that are returned by the CWinApp method LoadStandardCursor. The global function AfxGetApp returns a pointer to the application object (there is only one). The cursor is set in the view class by the SetCursor Win32 API function.

CWinApp* AfxGetApp();
HCURSOR LoadStandardCursor(CString stCursorName) const;
HCURSOR SetCursor(HCURSOR hCursor);

The parameter stCursorName could be any of the following predefined constants.

IDC_ARROW

Standard arrow cursor.

IDC_IBEAM

Standard text-insertion cursor.

IDC_CROSS

Cross-hair cursor for selection.

IDC_SIZEALL

A four-pointed arrow, the cursor used to resize a window.

IDC_SIZEWE

Horizontal two-headed arrow.

IDC_SIZENS

Vertical two-headed arrow.

IDC_SIZENWSE

Two-headed arrow aimed at the upper left and lower...