Skip to main content
GameDev.net gamedev.net
🔒 Locked

Win32 SetCursor()

Started by Thevenin Oct 30, 2005 at 11:09 PM 2 replies 1.9k views
Original Post
Thevenin
Thevenin
When I call SetCursor(), it changes the mouse icon for the window, but than it quickly changes back to an arrow. To prevent this, I captured the mouse message...
case WM_SETCURSOR:
   return 0;
break;
... however, now it won't change the mouse icon when the user trys to resize the window. Any ideas how to fix this?
taby
taby
[Edit: I missed the point. Sorry. :)]

The first hit on deja.com for "setcursor doesn't work" points out that you must explicitly handle the WM_SETCURSOR WndProc message. You must return TRUE.

case WM_SETCURSOR:{	return TRUE;}


[Edited by - taby on October 31, 2005 12:29:44 AM]
Thevenin
Thevenin
Quote:
Original post by taby
The first hit on deja.com for "setcursor doesn't work" points out that you must explicitly handle the WM_SETCURSOR WndProc message. You must return TRUE.

*** Source Snippet Removed ***


It works either way (True or False). The problem is, it won't change the mouse icon when the user trys to resize the window; eg... windows no longer automatically changes the mouse icon.

mikeman
mikeman
Using SetCursor for that is too much trouble. You must have the cursor class for the window to be NULL, and you must track down the cursor's movement: when it enters the window, you set it to the desired shape, when it leaves or when another window gains control, you must restore it.

It's much easier to just set the cursor class(the hCursor member in the WNDCLASS structure) before you create the window.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.