I'm wondering why this code doesn't work: invoke GetDesktopWindow
mov hDesktop,eax
invoke LoadImage,hInstance,addr CursorName,IMAGE_CURSOR,32,32,LR_LOADFROMFILE
invoke SetClassLong,hWnd,GCL_HCURSOR,eax
Thanks for in advenace for help
Quote from: xandaz on December 21, 2021, 11:06:33 PM
I'm wondering why this code doesn't work: invoke GetDesktopWindow
mov hDesktop,eax
invoke LoadImage,hInstance,addr CursorName,IMAGE_CURSOR,32,32,LR_LOADFROMFILE
invoke SetClassLong,hWnd,GCL_HCURSOR,eax
Thanks for in advenace for help
Where do you have that code?
If you don't use WM_SETCURSOR message it only works until next mouse move
https://docs.microsoft.com/en-us/windows/win32/learnwin32/setting-the-cursor-image
(https://docs.microsoft.com/en-us/windows/win32/learnwin32/setting-the-cursor-image)
Thanks daydreamer. The code is in WndProc.
Still downt work with the WM_SETCIRSOR message. reutrns 0
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadimagea (https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadimagea)
If the fuLoad parameter includes the LR_LOADFROMFILE value, lpszName is the name of the file that contains the stand-alone resource (icon, cursor, or bitmap file). Therefore, set hinst to NULL.
However, your code snippet does not explain what you want to achive.
If you want to set the cursor for your own window, just put SetCursor (hCursor) into your WM_MOUSEMOVE.
Additional error ...
invoke GetDesktopWindow
mov hDesktop,eax
invoke LoadImage,hInstance,addr CursorName,IMAGE_CURSOR,32,32,LR_LOADFROMFILE
invoke SetClassLong,hWnd,GCL_HCURSOR,eax
To change the cursor of foreign windows is not very polite ...
You will find that as the desktop is a different running process running in its own memory space, it is not a viable task to change the characteristics of another binary file.
ok guys. learmed much. thanks