Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Changing the system cursor


  • Please log in to reply
53 replies to this topic
Serenity
  • Members
  • 1271 posts
  • Last active:
  • Joined: 07 Nov 2004
I've updated the wrapper function. It now replaces the cursor *everywhere* except for where applications set their own cursor. At last!

There remains a small bug when loading an animated cursor via a hotkey but it loads fine when using Krogdor's code:

Space::
SetSystemCursor("anicursor.ani")
KeyWait, Space
RestoreCursors()
Return

"Anything worth doing is worth doing slowly." - Mae West
Posted Image

Kronglor
  • Guests
  • Last active:
  • Joined: --
Hello, I am just curious, this works really great, except I find in Vista, when I set a cursor from image using this SetSystemCursor() method, Vista overrides the cursor image with a gradient 'shadow' around it! It didn't do this in XP. This thing vista does to the cursor makes my custom cursor look funny. But I am curious if you know how to set the image cursor without that attribute? :)

Serenity
  • Members
  • 1271 posts
  • Last active:
  • Joined: 07 Nov 2004
I'm not sure why that is happening. LoadImage doesn't have an attribute for cursor shadow, so this might need setting with another function. I don't have Vista to try this. What file type are you loading as cursor? Does it happen with .cur files?
"Anything worth doing is worth doing slowly." - Mae West
Posted Image

Kronglor
  • Guests
  • Last active:
  • Joined: --
Hello there Serenity... I am actually loading this as a .ICO. I also tried the .CUR image file format, and the same shadow appears... which seems to mimic the standard shadow around the normal arrow cursor in Vista :/

Serenity
  • Members
  • 1271 posts
  • Last active:
  • Joined: 07 Nov 2004
You could try removing the shadow with SPI_SETCURSORSHADOW:

SPI_SETCURSORSHADOW = 0x101B
DllCall( "SystemParametersInfo", UInt,SPI_SETCURSORSHADOW, UInt,0, Int,0, UInt,0 ) ; off
DllCall( "SystemParametersInfo", UInt,SPI_SETCURSORSHADOW, UInt,0, Int,1, UInt,0 ) ; on

"Anything worth doing is worth doing slowly." - Mae West
Posted Image

Kronglor
  • Guests
  • Last active:
  • Joined: --
Brilliant!

Have a very nice day. :D

dhcman5454
  • Guests
  • Last active:
  • Joined: --
I'm trying to get an animated cursor that is 64x64 pixels to display and it keeps getting scaled down to 32x32, so I tried looking into it found out about scripting but since I'm a totally newbie with this kind of stuff, I was wondering if you could help me out.

I want to set my regular arrow cursor to be an animated cursor that is 64x64 and totally unscaled.

this is the cursor file
C:\WINDOWS\Cursors\DHC_cursors\mattrednormalbig.ani

how am I going to go about doing this?

  • Guests
  • Last active:
  • Joined: --
This script improved the quality of my life by 3%

Hoobas
  • Guests
  • Last active:
  • Joined: --
#SingleInstance Force

space::
   SetSystemCursor("IDC_WAIT")
   KeyWait, Space
   RestoreCursors()
Return
esc::exitapp


Can anybody point out what is wrong with this?
It doesn't run well in my computer.
Error shown: Call to nonexistent function

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

Can anybody point out what is wrong with this?


You need to copy/paste the wrapper function SetSystemCursor() function from the title post

Hoobas
  • Guests
  • Last active:
  • Joined: --
Thanks a lot SKAN!!!, it works
But the cursor will be override by the cursor of other application, for example Microsoft word, Is there anyway to fix this??

Chicken Pie 4 Tea
  • Members
  • 379 posts
  • Last active: Dec 12 2014 06:46 PM
  • Joined: 18 Aug 2009
thanks this will be useful when doing a video tutorial, on most video tutorials they always seem to use the default little white arrow that is sometimes hard to follow so with this i can easily change it to a bigger red one!
"Choose your parents wisely"

  • Guests
  • Last active:
  • Joined: --
Is it possible to change several cursors from a file in the same script? I mean: change the arrow, the wait, the help and the appstarting with 4 new cursors in 4 different files? Following the examples, I can change only the arrow, or all with the arrow.

Zizou
  • Members
  • 32 posts
  • Last active: Oct 31 2017 05:51 AM
  • Joined: 16 Nov 2008
I was looking for this. Thanks, pal.

joelpt
  • Members
  • 23 posts
  • Last active: Dec 09 2011 10:05 PM
  • Joined: 24 Jun 2009
Any way to do the reverse -- GetSystemCursor()? Specifically, I'm looking for a way to detect when the mouse pointer is over something that can be resized, e.g. a window border, which shows the appropriate mouse resize cursor.

Edit: 2 minutes later I discovered A_Cursor. :roll:
<!-- m -->http://www.autohotke...bles.htm#Cursor<!-- m -->