|
本帖最后由 batche 于 2023-6-29 22:08 编辑
用注册表修改了光标样式后需要注销才能生效,有一个api函数可以刷新光标,参考:learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfoa
- using System;
- using System.Runtime.InteropServices;
-
- public static class User32
- {
- [DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
- public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, IntPtr pvParam, uint fWinIni);
- }
- public class Program
- {
- public static void Main()
- {
- User32.SystemParametersInfo(0x0057, 0, IntPtr.Zero, 0);
- }
- }
复制代码 补充一下,用powershell动态编译:- Add-Type @"
- using System;
- using System.Runtime.InteropServices;
- public static class User32 {
- [DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
- public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, IntPtr pvParam, uint fWinIni);
- }
- "@
- [void][User32]::SystemParametersInfo(0x0057, 0, [IntPtr]::Zero, 0)
复制代码
|
|