- NSIS Discussion
- Cursor Image reload
Archive: Cursor Image reload
DOCa Cola
3rd September 2003 10:38 UTC
Cursor Image reload
Hi!
i sometimes use an old app which everytime i use it replaces the windows cursors with custom cursors for the arrow, textselect and the hourglass.
it should remove the custom cursors after i close the app, but i have read in a faq that this is a known bug since windows 2000/xp and there will be no furthur support for it. the cursors are used globally after i closed the app and even are selected in the pointers tab in the mouse properties in the control panel. but when i logout and login again or restart my computer the cursors are all normal. it seems the only problem that the custom cursors of that app don't go away is that they are not refreshed anymore after closing the app. i wanted to write a small script with the help of the system plugin to refresh the cursors manually but i have (again) no idea how to begin, maybe someone could help me...
I have looked through the imports of the app and found for user32.dll
LoadCursorA
SetCursor
so i looked through msdn for it and came to that site
hope that helps
DOCa Cola
brainsucker
4th September 2003 00:15 UTC
Could you post more information about that bug? It will be much easier to know what to do if we will know the way that program corrupts the cursors. may be a link to faq will help.
DOCa Cola
4th September 2003 10:48 UTC
it does not corrupt the cursors, it loads a new cursor set which replaces the standard windows cursors, but since windows 2000/xp it is unable to unload the cursors after the program has quit, so they stay until i restart, logoff/logon or reset them in the mouse properties in the control panel...
n0On3
5th September 2003 13:07 UTC
Modified cursors are stored in the registry in "CU\Control Panel\Cursors". Maybe if you delete values inside that folder, you will regain old cursors on reboot. (I tried the 'refresh icons' thing and didn't refresh cursors)
brainsucker
5th September 2003 17:44 UTC
If he reboots the cursors are restored anyway :) He just wants to do that without rebooting :)
the following function does what she wants, but where should we look for default cursors? ;)
BOOL SetSystemCursor(HCURSOR hcur, DWORD id);
brainsucker
5th September 2003 18:04 UTC
It looks like cursors (changed one) are stored at HKCU\Control Panel\Cursors. Default cursors are default :)
You could load and set listed cursors and try to set not listed to NULL (0) (may be this will restore them).
Here the functioon prototype (look at msdn for parameters):
System::Call 'user32::SetSystemCursor(i r0, i 32512) i'
also you will need (will place cursor handle to r0, you should pass it SetSystemCursor).
System::Call 'user32::LoadImage(i 0, t "file name", i 2, i 0, i 0, i 0x10) i.r0'
list of constants for SetSystemCursor second arg:
#define OCR_NORMAL 32512
#define OCR_IBEAM 32513
#define OCR_WAIT 32514
#define OCR_CROSS 32515
#define OCR_UP 32516
#define OCR_SIZENWSE 32642
#define OCR_SIZENESW 32643
#define OCR_SIZEWE 32644
#define OCR_SIZENS 32645
#define OCR_SIZEALL 32646
#define OCR_NO 32648
#define OCR_HAND 32649
#define OCR_APPSTARTING 32650
DOCa Cola
6th September 2003 00:03 UTC
ok, i got it to work to load a cursor, but thats the same as the program does...so
i attached a sample code to change to cursor to another one, maybe you will find a way, i tried to load a 'null' cursor (to reset to the default arrow), but that does not work
DOCa Cola
n0On3
6th September 2003 13:26 UTC
Originally posted by brainsucker
[B]If he reboots the cursors are restored anyway :) He just wants to do that without rebooting :)
:rolleyes: :hang:
DOCa Cola
6th September 2003 13:33 UTC
i like the idea to load up custom cursors, and it's a simple but useful function (maybe for more custom setups), now only a way is missing to unload them again to fix the problem with my program, i think the program loads the cursors exact the same way.
DOCa Cola
DOCa Cola
14th September 2003 16:06 UTC
any ideas how to get the default windows cursors back? :)
DOCa Cola
DOCa Cola
14th September 2003 16:20 UTC
ok..
now there is
HCURSOR LoadCursor(
HINSTANCE hInstance,
LPCTSTR lpCursorName
);
so
hInstance
[in] Handle to an instance of the module whose executable file contains the cursor to be loaded.
so, which handle should i use then?
i have no idea.. (i am no programmer :))
DOCa Cola
DOCa Cola
17th September 2003 14:19 UTC
bump
sorry, don't want this thread get lost..please someone help me and load my example program and help me to reset the cursors to standard back after that..
brainsucker
17th September 2003 23:51 UTC
LoadCursor handle: you should give it a handle to the file you want to use as a source for cursor.
sorry ;)
brainsucker
19th September 2003 11:27 UTC
Sorry again :) Lost my mind. This should work:
System::Call "user32::SystemParametersInfo(i 0x057, i 0, i 0, i 0x02) i.r0"
DOCa Cola
21st September 2003 16:46 UTC
oh! thank you very very much :)
Great work! Works very nice, now i am really happy :)
DOCa Cola