Cursor change
-
How do I change the cursor when the mouse pointer is on a button or on a notified picture???
-
How do I change the cursor when the mouse pointer is on a button or on a notified picture???
-
Can we get a little more help on this issue. I have been trying to do this for the past week but no luck...I have four ownerdrawn windows on my main window for which I would like to use the hand cursor like in internet explorer but all I get is the stinken' arrow. Here is the code that I use. WM_MOUSEMOVE: x = LOWORD (lParam); y = HIWORD (lParam); RECT rect; GetWindowRect(hwndView, &rect); // Handle to one of the owner drawn buttons if ( ( x >= rect.left && x <= rect.right ) && ( y >= rect.bottom && y <= rect.top ) ) ShowCursor(hCursor); break; All with no luck...Is there a difference in the coordinates of the mouse and the ones received by GetWindowRect? If so shouldn't the mouse cursor appear somewhere else on the window...for me, just the stinken' arrow :((
-
Can we get a little more help on this issue. I have been trying to do this for the past week but no luck...I have four ownerdrawn windows on my main window for which I would like to use the hand cursor like in internet explorer but all I get is the stinken' arrow. Here is the code that I use. WM_MOUSEMOVE: x = LOWORD (lParam); y = HIWORD (lParam); RECT rect; GetWindowRect(hwndView, &rect); // Handle to one of the owner drawn buttons if ( ( x >= rect.left && x <= rect.right ) && ( y >= rect.bottom && y <= rect.top ) ) ShowCursor(hCursor); break; All with no luck...Is there a difference in the coordinates of the mouse and the ones received by GetWindowRect? If so shouldn't the mouse cursor appear somewhere else on the window...for me, just the stinken' arrow :((
anonymous wrote: Is there a difference in the coordinates of the mouse and the ones received by GetWindowRect? Yes! As MSDN clearly states (in the entry for
WM_MOUSEMOVE
):"The coordinate is relative to the upper-left corner of the client area." So a simpleClientToScreen()
on the mouse coordinates should help. -
anonymous wrote: Is there a difference in the coordinates of the mouse and the ones received by GetWindowRect? Yes! As MSDN clearly states (in the entry for
WM_MOUSEMOVE
):"The coordinate is relative to the upper-left corner of the client area." So a simpleClientToScreen()
on the mouse coordinates should help.Thanks for the help, finally got it working but it wasn't the screen coordinates that were the problem. I didn't pay attention to the fact that WM_MOUSEMOVE is posted TO THE WINDOW THE CURSOR IS UNDER! In my case the buttons so what I needed to do is basically subclass the window which worked great...thanks for your help...I do have another question on this if you could help me with it. Although not a tragedy, when I click on the button now the cursor changes to an arrow and then back which is fine because it is a quick change but for other buttons which invoke dialog boxes then the cursor stays into an arrow over the button where it should be a hand. Is there a way to make the cursor be a hand until it is out of the window regardless of clicking?