Introduction

Windows' Mouse Control Panel Applet

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.

Run-down

There are two main steps that you have to do.

  1. Update the strings listed in HKEY_CURRENT_USER\Control Panel\Cursors with the locations of the cursors that you want to use.
    1. You can lookup the defined cursor schemes from either HKEY_CURRENT_USER\Control Panel\Cursors\Schemes or HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cursors\Schemes
  2. Call SystemParametersInfo with SPI_SETCURSORS as the uiAction

Details

There are three main registry keys that come into play.

  1. The registry key HKEY_CURRENT_USER\Control Panel\Cursors contains the active user cursors
    1. The values underneath this are the different types of cursors
    2. The 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.
      1. 0 – Windows Default
      2. 1 – User Scheme
      3. 2 – System Scheme
  2. The registry key HKEY_CURRENT_USER\Control Panel\Cursors contains the user defined cursor schemes (i.e. Scheme Source = 1)
  3. The registry key 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.

A Successful Call to SystemParametersInfo

Changing to the Default Windows Cursor

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

3:51 p.m. Thursday Nov. 20, 2008 (about 1 year, 3 months after publishing)
Very helpful for a weird problem Jonathan
Just a note of thanks for this AHK. I have a very strange issue where if I connect to an RDP session in a window, eventually my hosts' mouse cursor will change to the 4-way arrow and never change back. It looks normal in the RDP window, but not on the host! Very strange.
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!
6:32 p.m. Saturday Nov. 22, 2008 (about 1 year, 3 months after publishing)
RE: Very helpful for a weird problem farhan
Hi Jonathan,

I am glad this helped eliminate some annoyance for you :)

- Farhan
4:55 a.m. Monday Apr. 13, 2009 (about 1 year, 8 months after publishing)
Invalid Scheme Type...? Jeremy Knight
Hi 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?

3:56 a.m. Tuesday Apr. 14, 2009 (about 1 year, 8 months after publishing)
RE: Invalid Scheme Type...? Jeremy
I'm not sure what I had done before, possibly download format. However I downloaded the file again, substituted my mouse scheme name, compiled, and it runs perfectly.

Thanks very much Farhan! :) This is the only place on the internet I have found to do this.
11:23 a.m. Tuesday Apr. 14, 2009 (about 1 year, 8 months after publishing)
RE: RE: Invalid Scheme Type...? farhan
Thanks, Jeremy. I am glad this worked for you.
8:30 p.m. Saturday Mar. 19, 2011 (about 3 years, 7 months after publishing)
RE: RE: RE: Invalid Scheme Type...? James
Hi Farhan,

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,
5:13 p.m. Sunday Mar. 20, 2011 (about 3 years, 7 months after publishing)
RE: Invalid Scheme Type...? farhan
Hi 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.
2:27 a.m. Sunday Jun. 13, 2010 (about 2 years, 10 months after publishing)
Re: costume
“Windows Default” is defined as... or in other words no pointers to actual cursors!
2:28 a.m. Sunday Jun. 13, 2010 (about 2 years, 10 months after publishing)
Re: costume
“Windows Default” is defined as... or in other words no pointers to actual cursors!
2:28 a.m. Sunday Jun. 13, 2010 (about 2 years, 10 months after publishing)
Re: costume
“Windows Default” is defined as... or in other words no pointers to actual cursors!
3:28 a.m. Saturday Dec. 18, 2010 (about 3 years, 4 months after publishing)
never knew single parents
i never knew about that.thanks a lot
2:32 a.m. Monday Sep. 12, 2011 (about 4 years after publishing)
alternative Jody
Unfortunately windows is offering a small variety of mouse cursors, but there are hundreds of programs which allows you to choose from many other offers, without a need to play with you CPanel
5:19 p.m. Thursday Jul. 26, 2012 (about 4 years, 11 months after publishing)
Fantastic Neal
This was fantastic. Only place on web to see this info.
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
2:26 a.m. Tuesday Aug. 20, 2013 (about 6 years after publishing)
Reply cimiac
thank you
6:17 a.m. Friday Nov. 1, 2013 (about 6 years, 2 months after publishing)
Doesn't reflect urgently Nitin Surana
hey!

I tried changing the cursor by manually editing the /ControlPanel/Cursor/somekey but it doesn't reflect. It reflects only after re-start or log-off.

I actually need to change it programatically from java, so I need the new cursor to appear/change instantly. Do you know how can this be done ?
12:30 p.m. Friday Nov. 8, 2013 (about 6 years, 2 months after publishing)
RE: Doesn't reflect urgently farhan
Hi Nitin,

I think the issue is that you have to signal the operating system so it knows that the registry key has changed. Are you making the SystemParametersInfo call afterwards?

http://stackoverflow.com/questions/4750372/can-i-change-my-windows-desktop-wallpaper-programmatically-in-java-groovy
12:53 p.m. Friday Nov. 8, 2013 (about 6 years, 2 months after publishing)
RE: RE: Doesn't reflect urgently Nitin Surana
Thanks a lot for replying. Fortunately, I solved it that day itself. And the issue was of course as you said - there was no call to SystemParametersInfo
10:53 a.m. Tuesday Nov. 18, 2014 (about 7 years, 3 months after publishing)
Changing Default Mouse Pointer Colour On Boot Graham Hathway
Please has anyone got any idea of how to change the default colour white to eg black before login ?
12:53 p.m. Tuesday Nov. 18, 2014 (about 7 years, 3 months after publishing)
RE: Changing Default Mouse Pointer Colour On Boot farhan
I never paid attention to pre-login cursors so I am not sure if this applies to that. Looking at the key I would guess that it does...?