小编Dav*_*son的帖子

如何在 Windows 中更改鼠标指针大小?

在我的 4k 屏幕上,我喜欢在窗口中调大鼠标指针的大小。
将 Windows 鼠标指针设置为 4

这对于 95% 的使用情况来说非常有用,但有时我又需要一个小鼠标指针来进行更精细的工作。
不幸的是我每次都必须打开设置,我想要一个键盘快捷键,可以用来在大鼠标和小鼠标之间切换。

所以我写了以下内容,希望能起到作用:

  1. 使用新的鼠标大小设置更新注册表
  2. 使用SystemParametersInfo()参数调用SPI_SETCURSORS来点动系统以重新读取鼠标设置。

唉,没有喜悦。

谁能指出我的做法是愚蠢的吗?干杯,戴夫

代码如下:

param([int]$MouseSize=0)

###########################################
#
# DISAPPOINTINGLY  THIS DOES NOT YET WORK
# Need to figure out why
#
###########################################
 
##################
# Constants
##################
 
[int]$small_mouse = 48
[int]$big_mouse   = 80
[int]$min_mouse   = 1
[int]$max_mouse   = 256
 
[string]$path = 'HKCU:\Control Panel\Cursors'
[string]$name = 'CursorBaseSize'
 
##################
# API Import
##################
 
Try{
    [void][SysParams]
} Catch {
Add-Type @'
    using System;
    using System.Runtime.InteropServices;
    public class SysParams {
        [DllImport("user32.dll", SetLastError …
Run Code Online (Sandbox Code Playgroud)

c# windows powershell mouse-cursor

5
推荐指数
1
解决办法
889
查看次数

标签 统计

c# ×1

mouse-cursor ×1

powershell ×1

windows ×1