Jump to content

Win 10/11 Mouse pointer get/set ( color too )


Go to solution Solved by argumentum,

Recommended Posts

  • argumentum changed the title to Win 10/11 Mouse pointer get/set ( color too )
  • Solution
#include <WinAPIRes.au3> ; _WinAPI_SetSystemCursor()
#include <WinAPISys.au3> ; _WinAPI_SystemParametersInfo()
#include <WinAPIsysinfoConstants.au3> ; for $SPI_SETCURSORS

;~ Local $hPrev = _WinAPI_CopyCursor(_WinAPI_LoadCursor(0, $OCR_NORMAL)) ; Is not going to be used because ...
_WinAPI_SetSystemCursor(_WinAPI_LoadCursorFromFile(StringLeft(@AutoItExe, _
        StringInStr(@AutoItExe, '\', 0, -1) -1) & '\Examples\Helpfile\Extras\Lens.cur'), $OCR_NORMAL)
Sleep(5000)
;~ _WinAPI_SetSystemCursor($hPrev, $OCR_NORMAL) ... we are gonna use SystemParametersInfo
_WinAPI_SystemParametersInfo($SPI_SETCURSORS, 0, 0, 0)

My drama was to restore the original back and the above does just that.
The get part is in the registry. 

Spoiler
#include <Debug.au3>
_DebugArrayDisplay(MousePointer_GetSettings())
Func MousePointer_GetSettings()
    Local $aCursor[2][25]
    $aCursor[0][0] = "ContactVisualization" ; REG_DWORD_LITTLE_ENDIAN
    $aCursor[1][0] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][0]) ;
    $aCursor[0][1] = "CursorBaseSize" ; REG_DWORD_LITTLE_ENDIAN
    $aCursor[1][1] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][1]) ;
    $aCursor[0][2] = "GestureVisualization" ; REG_DWORD_LITTLE_ENDIAN
    $aCursor[1][2] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][2]) ;
    $aCursor[0][3] = "Scheme Source" ; REG_DWORD_LITTLE_ENDIAN
    $aCursor[1][3] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][3]) ;
    $aCursor[0][4] = "Appstarting" ; REG_EXPAND_SZ
    $aCursor[1][4] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][4]) ;
    $aCursor[0][5] = "Arrow" ; REG_EXPAND_SZ
    $aCursor[1][5] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][5]) ;
    $aCursor[0][6] = "Crosshair" ; REG_EXPAND_SZ
    $aCursor[1][6] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][6]) ;
    $aCursor[0][7] = "Hand" ; REG_EXPAND_SZ
    $aCursor[1][7] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][7]) ;
    $aCursor[0][8] = "Help" ; REG_EXPAND_SZ
    $aCursor[1][8] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][8]) ;
    $aCursor[0][9] = "IBeam" ; REG_EXPAND_SZ
    $aCursor[1][9] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][9]) ;
    $aCursor[0][10] = "No" ; REG_EXPAND_SZ
    $aCursor[1][10] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][10]) ;
    $aCursor[0][11] = "NWPen" ; REG_EXPAND_SZ
    $aCursor[1][11] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][11]) ;
    $aCursor[0][12] = "Person" ; REG_EXPAND_SZ
    $aCursor[1][12] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][12]) ;
    $aCursor[0][13] = "Pin" ; REG_EXPAND_SZ
    $aCursor[1][13] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][13]) ;
    $aCursor[0][14] = "SizeAll" ; REG_EXPAND_SZ
    $aCursor[1][14] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][14]) ;
    $aCursor[0][15] = "SizeNESW" ; REG_EXPAND_SZ
    $aCursor[1][15] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][15]) ;
    $aCursor[0][16] = "SizeNS" ; REG_EXPAND_SZ
    $aCursor[1][16] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][16]) ;
    $aCursor[0][17] = "SizeNWSE" ; REG_EXPAND_SZ
    $aCursor[1][17] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][17]) ;
    $aCursor[0][18] = "SizeWE" ; REG_EXPAND_SZ
    $aCursor[1][18] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][18]) ;
    $aCursor[0][19] = "UpArrow" ; REG_EXPAND_SZ
    $aCursor[1][19] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][19]) ;
    $aCursor[0][20] = "Wait" ; REG_EXPAND_SZ
    $aCursor[1][20] = RegRead("HKEY_CURRENT_USER\Control Panel\Cursors", $aCursor[0][20]) ;
    $aCursor[0][21] = "CursorType" ; REG_DWORD_LITTLE_ENDIAN
    $aCursor[1][21] = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Accessibility", $aCursor[0][21]) ;
    $aCursor[0][22] = "CursorSize" ; REG_DWORD_LITTLE_ENDIAN
    $aCursor[1][22] = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Accessibility", $aCursor[0][22]) ;
    $aCursor[0][23] = "CursorColor" ; REG_DWORD_LITTLE_ENDIAN
    $aCursor[1][23] = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Accessibility", $aCursor[0][23]) ;
    $aCursor[0][24] = "IndicatorColor" ; REG_DWORD_LITTLE_ENDIAN
    $aCursor[1][24] = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Accessibility\CursorIndicator", $aCursor[0][24]) ;
    Return $aCursor
EndFunc

 

Unless someone finds something better, then its solved.

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

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...