CWnd::OnSetCursor

Syntax

afx_msg BOOL OnSetCursor( CWnd* pWnd, UINT nHitTest, UINT message );

Parameters

pWnd

Specifies a pointer to the window that contains the cursor. The pointer may be temporary, and should not be stored for later use.

nHitTest

Specifies the hit-test area code. The hit test determines the cursor's location.

message

Specifies the mouse message number.

Remarks

OnSetCursor is called if mouse input is not captured and the mouse causes cursor movement within the CWnd.

This message-handler member function calls the Default member function. Override this member function in your derived class to handle the WM_SETCURSOR message.

By default, OnSetCursor calls the parent window's OnSetCursor before processing. If the parent window returns TRUE, further processing is halted. Calling the parent window gives the parent window control over the cursor's setting in a child window.

By default, OnSetCursor also sets the cursor to an arrow if it is not in the client area, or to the registered-class cursor if it is. If nHitTest is HTERROR and message is a mouse button-down message, the MessageBeep member function is called.

The message parameter is 0 when CWnd enters menu mode.

Return Value

The return value is ignored by Windows, but is used by the Default member function when it calls the parent to determine if the parent handled the message. TRUE means that the message was handled; otherwise FALSE.

See Also

CWnd::OnNcHitTest, CWnd::Default, WM_SETCURSOR