Share via


CWnd::OnSetCursor

The framework calls this member function if mouse input is not captured and the mouse causes cursor movement within the CWnd object.

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.

Return Value

Nonzero to halt further processing, or 0 to continue.

Remarks

The default implementation 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.

The default implementation 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.

Note

This member function is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function.

Requirements

Header: afxwin.h

See Also

Reference

CWnd Class

Hierarchy Chart

CWnd::OnNcHitTest

WM_SETCURSOR

Other Resources

How Do I: Change the Mouse Cursor in an Microsoft Foundation Class Application?