我已经编写了下面的代码,可以影响(我认为)是 Windows 10 中光标和指针大小唯一负责的注册表键。
以下是到目前为止我编写的代码(其中有一些注释):
以下是相关的微软链接:
以下是到目前为止我编写的代码(其中有一些注释):
$RegConnect = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]"CurrentUser", "$env:COMPUTERNAME")
$RegCursorsAccess = $RegConnect.OpenSubKey("Software\Microsoft\Accessibility", $true)
$RegCursorsControlPanel = $RegConnect.OpenSubKey("Control Panel\Cursors", $true)
# In the code below I'm trying to change the size of the cursor.
$RegCursorsControlPanel.SetValue("CursorBaseSize", 48)
$RegCursorsAccess.SetValue("CursorSize", 3)
$RegCursorsAccess.Close()
$RegConnect.Close()
# This section is where I thought it would update the cursor size.
# Here is where it lists stuff relating to setting and updating any settings changed.
# https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfoa
# SPI_SETCURSORS
# 0x0057
# Reloads the system cursors. Set the uiParam parameter to zero and the pvParam parameter to NULL.
$CSharpSig = @'
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(
uint uiAction,
uint uiParam,
uint pvParam,
uint fWinIni);
'@
$CursorRefresh = Add-Type -MemberDefinition $CSharpSig -Name WinAPICall -Namespace SystemParamInfo -PassThru
$CursorRefresh::SystemParametersInfo(0x0057,0,$null,0)
它将更改注册表中的正确值。
因此,如果我运行此 PowerShell 代码,则辅助功能设置中的鼠标大小为正确值。
但光标没有更新。
如何在不注销、重新登录或重启计算机的情况下强制更新。
以下是相关的微软链接:
编辑 - 一些额外信息
如果我运行Sysinternals的进程监视器并深入挖掘,我可以在堆栈摘要下看到这个。
这可能会帮助比我更有知识的人找到如何更新鼠标大小。
HKCU\Control Panel\Cursors\(Default)
部分SettingsHandlers_nt.dll
这也与无障碍性部分相关。 Windows.UI.Accessibility.dll
以下是我在Process Monitor的筛选器中使用的设置,以缩小项目范围。