Mouse Cursor change color on click

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Azerrz
Posts: 4
Joined: 06 Jul 2022, 02:14

Mouse Cursor change color on click

Post by Azerrz » 06 Jul 2022, 02:33

There is this Recording software named "Xsplit" where the option "Show mouse clicks" has this effect in the output video, where the mouse pointer changes from white (default) to black color to indicate the usage of the left mouse button. Now, this effect only shows in the output video. How do I make my pointer have this kind of effect always? Here's an example :

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Mouse Cursor change color on click

Post by mikeyww » 06 Jul 2022, 05:32

Welcome to this AutoHotkey forum!

Code: Select all

~LButton::SetSystemCursor("D:\images\cursors\bigRed.cur") ; Adjust as you wish
~LButton Up::RestoreCursors()

SetSystemCursor(file) { ; https://www.autohotkey.com/boards/viewtopic.php?t=75867
 CursorHandle := DllCall("LoadCursorFromFile", Str, file)
 Cursors = 32512,32513,32514,32515,32516,32640,32641,32642,32643,32644,32645,32646,32648,32649,32650,32651
 Loop, Parse, Cursors, `,
  DllCall("SetSystemCursor", Uint, CursorHandle, Int, A_Loopfield)
}

RestoreCursors() {
 SPI_SETCURSORS := 0x57, DllCall("SystemParametersInfo", UInt, SPI_SETCURSORS, UInt, 0, UInt, 0, UInt, 0)
}
Related: viewtopic.php?p=451694#p451694viewtopic.php?t=82431

Azerrz
Posts: 4
Joined: 06 Jul 2022, 02:14

Re: Mouse Cursor change color on click

Post by Azerrz » 06 Jul 2022, 07:27

mikeyww wrote:
06 Jul 2022, 05:32
Welcome to this AutoHotkey forum!

Code: Select all

~LButton::SetSystemCursor("D:\images\cursors\bigRed.cur") ; Adjust as you wish
~LButton Up::RestoreCursors()

SetSystemCursor(file) { ; https://www.autohotkey.com/boards/viewtopic.php?t=75867
 CursorHandle := DllCall("LoadCursorFromFile", Str, file)
 Cursors = 32512,32513,32514,32515,32516,32640,32641,32642,32643,32644,32645,32646,32648,32649,32650,32651
 Loop, Parse, Cursors, `,
  DllCall("SetSystemCursor", Uint, CursorHandle, Int, A_Loopfield)
}

RestoreCursors() {
 SPI_SETCURSORS := 0x57, DllCall("SystemParametersInfo", UInt, SPI_SETCURSORS, UInt, 0, UInt, 0, UInt, 0)
}
Related: viewtopic.php?p=451694#p451694viewtopic.php?t=82431
sorry, I have basically zero coding knowledge. What am I supposed to replace with what? The "dark colored" cursors file is named "darkcursors" in location "C:\Users\user\Desktop\darkcursors"

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Mouse Cursor change color on click

Post by mikeyww » 06 Jul 2022, 08:22

A cursor file usually has a ".cur" extension. You can replace the full path on line 1.

Azerrz
Posts: 4
Joined: 06 Jul 2022, 02:14

Re: Mouse Cursor change color on click

Post by Azerrz » 06 Jul 2022, 09:35

mikeyww wrote:
06 Jul 2022, 08:22
A cursor file usually has a ".cur" extension. You can replace the full path on line 1.
This code worked :

Code: Select all

file = E:\Games\Normal.cur

~LButton::SetSystemCursor(file)
~LButton Up::RestoreCursors()

SetSystemCursor(file) {
 CursorHandle := DllCall("LoadCursorFromFile", Str, file)
 Cursors = 32512,32513,32514,32515,32516,32640,32641,32642,32643,32644,32645,32646,32648,32649,32650,32651
 Loop, Parse, Cursors, `,
  DllCall("SetSystemCursor", Uint, CursorHandle, Int, A_Loopfield)
}

RestoreCursors() {
 SPI_SETCURSORS := 0x57, DllCall("SystemParametersInfo", UInt, SPI_SETCURSORS, UInt, 0, UInt, 0, UInt, 0)
}
However, this code changes just the pointer but doesn't change other cursors such as waiting cursor, link cursor, text cursor, precision crusor, working cursor. How do I change all of them?

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Mouse Cursor change color on click

Post by mikeyww » 06 Jul 2022, 09:48

The second link that I posted is @SKAN's SetCursorScheme. Could try that. I never used it.

Azerrz
Posts: 4
Joined: 06 Jul 2022, 02:14

Re: Mouse Cursor change color on click

Post by Azerrz » 06 Jul 2022, 10:17

mikeyww wrote:
06 Jul 2022, 09:48
The second link that I posted is @SKAN's SetCursorScheme. Could try that. I never used it.

I figured it out. Just need to change each cursor using CursorID individually and replace them with custom .cur file

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Mouse Cursor change color on click

Post by mikeyww » 06 Jul 2022, 10:23

Makes sense! Thanks for sharing. :thumbup:

mateejr
Posts: 3
Joined: 17 Dec 2022, 04:31

Re: Mouse Cursor change color on click

Post by mateejr » 17 Dec 2022, 04:47

Azerrz wrote:
06 Jul 2022, 10:17
mikeyww wrote:
06 Jul 2022, 09:48
The second link that I posted is @SKAN's SetCursorScheme. Could try that. I never used it.

I figured it out. Just need to change each cursor using CursorID individually and replace them with custom .cur file
hey could you help me how to do it? i don't really understand how to change other cursors too. thanks

wetware05
Posts: 750
Joined: 04 Dec 2020, 16:09

Re: Mouse Cursor change color on click

Post by wetware05 » 17 Dec 2022, 06:52

mateejr, good vibes

I think it only makes sense to change the color of the cursor when clicking (and at most they change with the right click), why change the color of the "waiting" cursor or that of resizing, if in the second case it is already done click when resizing and therefore it will only be seen in those cases?

What do you want that color change for? If what you want is to do online courses, programs like camtasia have effects that manifest themselves during the course. If what you want is to have the cursors in a different color, look for a gallery of cursors or edit them with programs like icoFX.

mateejr
Posts: 3
Joined: 17 Dec 2022, 04:31

Re: Mouse Cursor change color on click

Post by mateejr » 17 Dec 2022, 08:10

wetware05 wrote:
17 Dec 2022, 06:52
mateejr, good vibes

I think it only makes sense to change the color of the cursor when clicking (and at most they change with the right click), why change the color of the "waiting" cursor or that of resizing, if in the second case it is already done click when resizing and therefore it will only be seen in those cases?

What do you want that color change for? If what you want is to do online courses, programs like camtasia have effects that manifest themselves during the course. If what you want is to have the cursors in a different color, look for a gallery of cursors or edit them with programs like icoFX.
thanks for replying but i already figured it out. thank you

Post Reply

Return to “Ask for Help (v1)”