Published Thursday August 16, 2007
I really like the new Windows Vista mouse cursors, so much that I have switched all my computers, including the ones running Windows XP, to use them. They are awesome until you have to Remote Desktop to the computer, when, depending on your connection speed, the cursors can really slow down the mouse movement. This presented a challenge because not only did I not want to go through the control panel applet to change it back to the Windows Default scheme but also because changing cursors would be painstakingly slow due to the slow mouse movement. So, off I went to figure out how I could automate this.
I have not been able to find any good articles on the internet that explain how you can change cursors. This especially becomes a challenge if you have to change the cursors back to the “Windows Default” scheme, which is what I had to do. This article gives you an overview of how the cursors are organized and how you can go about applying cursors schemes.
Considering that I now use AutoHotkey for most of my shortcuts and automation, it made sense that this would be just another AHK script. Therefore, this article shows everything in the AHK syntax but don’t worry because it is not much different than most of the other languages.
There are two main steps that you have to do.
HKEY_CURRENT_USER\Control Panel\Cursors with the locations of the cursors that you want to use.
HKEY_CURRENT_USER\Control Panel\Cursors\Schemes or HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cursors\SchemesSPI_SETCURSORS as the uiAction
There are three main registry keys that come into play.
HKEY_CURRENT_USER\Control Panel\Cursors contains the active user cursors
Scheme Source specifies the type of cursor scheme that is currently being used. I haven’t been able to figure out the purpose of this but I have figured out what the different values are.
HKEY_CURRENT_USER\Control Panel\Cursors contains the user defined cursor schemes (i.e. Scheme Source = 1)HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Schemes contains the system cursor schemes (i.e. Scheme Source = 2)The cursor schemes contain the path to the cursors for the different cursor types as a comma delimited list. Below are the individual pieces.
These names are as they would appear in the HKCU\Control Panel\Cursors. If you are a curious one you would have already changed the path to one of the cursor type in HKCU\Control Panel\Cursors and realized that it did not do anything. You are correct, just updating a key – HKCU\Control Panel\Cursors\Arrow, for instance – isn’t enough. You have to tell windows to load the new cursor.
This is where the SystemParametersInfo call comes in. To try this out let’s go ahead and change HKCU\Control Panel\Cursors\Arrow to C:\WINDOWS\Cursors\appstar3.ani (assuming you have this icon) and then make a call to SystemParametersInfo.
SPI_SETCURSORS := 0x57
result := DllCall("SystemParametersInfo", "UInt", SPI_SETCURSORS, "UInt", 0, "UInt", 0, "UInt", '0')
MsgBox Error Level: %ErrorLevel% `nLast error: %A_LastError%`nresult: %result%
If everything worked then you should see the 3D animating cursor as your default arrow and the following message box.

Now the tricky part. If you look at HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Schemes you will notice that “Windows Default” is defined as “,,,,,,,,,,,,,” or in other words no pointers to actual cursors!
What to do now? Don’t worry. All you have to do is set the different cursor types to empty string and then make the SystemParametersInfo call as usual. In fact, you can set any of the cursor type to empty string in any scheme and Windows will default it to it’s equivalent in the “Windows Default” scheme.
There you have it!
You also can download the complete AutoHotkey script that I wrote.
Comments
So, I took your script and threw it on my quick launch toolbar. Now, when RDP breaks my mouse, I just click the 'fixer' and voila! back to normal. Thanks again!
I am glad this helped eliminate some annoyance for you :)
- Farhan
I am having real problems with this AHK script. I have set the scheme to change to/from to 'sheller', but I always get this error.
Do you have any suggestions?
Thanks very much Farhan! :) This is the only place on the internet I have found to do this.
Thank you for providing a solution and the source file for this annoying problem. Recently, I have been using RemoteDesktop over Cisco VPN Client, and sometime I have had this kind of cursor problems for unknown reasons.
However, Could you please add more about how to compile and use the script?
I use Unix/Linux for daily work, and I know less about windows, not much more than surfing the internet, and using MS office etc.
Sincerely,
James,
It would take a little work to get this in a working condition where it can accept a configurable scheme name, but it is fairly easy to modify and compile the script that I provided for your specific needs. Take a look at the following URL.
http://www.autohotkey.com/docs/Scripts.htm#ahk2exe
If you are familiar with scripting in Linux than AutoHotkey shouldn't be a problem at all.
In fact I was searching for an Autohotkey script to do this on AHK website but didn't find it...I found it here instead. I am planning to use AHK to change cursors when a specific application is used and then change it back to the default.
Brilliant...Thanks very much