ok im setting a cursor in a loop it works but when i move the cursor it just changes back to the way it was. im using win32 api and i used
SetCursor(LoadCursor(hInstance, MAKEINTRESOURCE(IDC_PROTECTED)));
any idea
views:
78answers:
3
A:
Yes. It is being changed by DefWindowProc().
if you want a different cursor over your window, use SetClassLong(), or, change the hCursor field of WNDCLASS when calling RegisterClass, if you are the one who's calling it youself
Pavel Radzivilovsky
2010-08-24 05:58:03
im changing the cursor not when program starts when an event happenes
Ramiz Toma
2010-08-24 06:03:46
@Ramiz: How does that contradict the suggestion to call SetClassLong() ? (Actually, you want `SetClassLongPtr(GCLP_HCURSOR)` for 64 bits compat, but that's a detail)
MSalters
2010-08-24 06:37:16
+1
A:
IIRC, you want to call SetCursor
in response to WM_SETCURSOR
. If memory serves, the cursor will also stay what you've set if the cursor member of the window class is set to NULL.
Jerry Coffin
2010-08-24 05:58:28
Tried which -- setting the class cursor to NULL, or calling `SetCursor` in response to `WM_SETCURSOR`? In the latter case, you also need to return `TRUE` from the message handler. I just did a quick check of responding to `WM_SETCURSOR` and it worked quite nicely.
Jerry Coffin
2010-08-24 06:07:17
when i register the window i have set it to my cursor but when it runs i see an hour glass cursor than when i set it to my other cursor it works. if i take out the WM_CURSOR the first cursor works but the second doesn't stay
Ramiz Toma
2010-08-24 06:15:55
Very bad suggestion in terms of efficiency (laptop battery power, etc).
Pavel Radzivilovsky
2010-08-24 07:27:43