Jump to content

_System_MouseCursor_SetSize(1)


argumentum
 Share

Recommended Posts

A way to set, or reset to your whishes, the mouse pointer size:

#include <WinAPISys.au3>

Example()
Func Example()
    Local $iOriginal = _System_MouseCursor_GetSize()
    ConsoleWrite(_System_MouseCursor_SetSize(15) & @CRLF)
    Sleep(1000)
    ConsoleWrite(_System_MouseCursor_SetSize($iOriginal) & @CRLF)
EndFunc   ;==>Example

Func _System_MouseCursor_SetSize($iSize = 1)
    If $iSize < 1 Then $iSize = 1 ; https://stackoverflow.com/questions/60104778/
    If $iSize > 15 Then $iSize = 15
    Return _WinAPI_SystemParametersInfo(0x2029, 0, 16 * ($iSize + 1), 0x01)
EndFunc   ;==>_System_MouseCursor_SetSize

Func _System_MouseCursor_GetSize()
    Local $iVal = RegRead("HKCU\Control Panel\Cursors", "CursorBaseSize")
    If @error Then Return SetError(@error, @extended, 1)
    Return SetError(@error, @extended, ($iVal / 16) - 1)
EndFunc   ;==>_System_MouseCursor_GetSize

..because in my case, it changes by itself after I jumped around my more than 1 monitor and resolutions and scale or RDPs and what not. This way I can click-click a solution

PS: I have not tried this but is an idea. Maybe I don't need to click anything if I catch it changing, it can fix itself:

GUIRegisterMsg($WM_SETTINGCHANGE,"MY_WM_SETTINGCHANGE")

Func MY_WM_SETTINGCHANGE($hWnd, $Msg, $wParam, $lParam)
    If $wParam = 0x00002029 Then AdlibRegister("putItBackYouYouCrazySystem")
EndFunc

Func putItBackYouYouCrazySystem()
    AdlibUnRegister("putItBackYouYouCrazySystem")
    _System_MouseCursor_SetSize($iMySize_but_needs_to_be_declared)
EndFunc

..anyways, hope it helps someone.

PS: I actually solved the problem with this code. What I have to do now is change the code in the script that's messing up the mouse pointer.

Edited by argumentum
better code

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • argumentum changed the title to _System_MouseCursor_SetSize(1)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...