
; 【示例】运行后改变整套光标方案,3秒后恢复原样
; 来源:https://www.autohotkey.com/boards/viewtopic.php?t=82431
#NoEnv
#SingleInstance Force
SetCursorScheme("Magnified")
Sleep 3000
SetCursorScheme("Windows Default") ; Windows 8.1 / 10
; SetCursorScheme("") ; Windows 7 / 8.1 / 10
Return
SetCursorScheme( Scheme ) { ; By SKAN on D3AO/D3AO @ tiny.cc/setcursorscheme
Local
Cursors := "Arrow,Help,AppStarting,Wait,Crosshair,IBeam,NWPen,No,SizeNS,"
. "SizeWE,SizeNWSE,SizeNESW,SizeAll,UpArrow,Hand,Pin,Person"
SchemePath2 := "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cursors"
SchemePath1 := "HKCU\Control Panel\Cursors"
SetRegView, 64
If ( Scheme="Windows Default" )
{
RegWrite, REG_SZ, %SchemePath1%,, Windows Default
RegWrite, REG_DWORD, %SchemePath1%, Scheme Source, 2
Loop, Parse, Cursors, CSV
{
RegRead, Val, %SchemePath2%\Default, %A_LoopField%
If (! ErrorLevel )
RegWrite, REG_EXPAND_SZ, %SchemePath1%, %A_LoopField%, %Val%
}
SetRegView, Default
Return DllCall("SystemParametersInfo", "Int",0x57, "Int", 0, "Ptr", 0, "Int", 0)
}
SchemeSource := 2
RegRead, Val, %SchemePath2%\Schemes, %Scheme%
If ( ErrorLevel )
{
SchemeSource := 1
RegRead, Val, %SchemePath1%\Schemes, %Scheme%
}
If ( ErrorLevel )
SchemeSource := 0, Scheme := ""
Cur := StrSplit(Val, ",")
RegWrite, REG_DWORD, %SchemePath1%, Scheme Source, %SchemeSource%
RegWrite, REG_SZ, %SchemePath1%,, %Scheme%
Loop, Parse, Cursors, CSV
{
RegRead, Val, %SchemePath2%\Default, %A_LoopField%
If (! ErrorLevel )
RegWrite, REG_EXPAND_SZ, %SchemePath1%, %A_LoopField%, % Cur[A_Index]
}
SetRegView, Default
Return DllCall("SystemParametersInfo", "Int",0x57, "Int", 0, "Ptr", 0, "Int", 0)
}
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GetCursorSchemes() {
Local Schemes := ""
SetRegView, 64
Loop, Reg
, HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cursors\Schemes, V
Schemes .= A_LoopRegName . "`n"
Loop, Reg, HKCU\Control Panel\Cursors\Schemes, V
Schemes .= A_LoopRegName . "`n"
SetRegView, Default
Return RTrim(Schemes, "`n")
}
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。

评论(0)