我想使用启动器打开 Windows 设置。它是 UWP 中的单行代码。文档:https://learn.microsoft.com/en-us/windows/uwp/launch-resume/launch-settings-app
bool result = await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-webcam"));
如何从 Windows 窗体应用程序执行此操作?
如何在 Windows 10 中打开显示设置(以编程方式,具体使用 C#)? 的答案指出使用
Process
,但这似乎只在 Win10 下工作,不再在 Win11 下工作。: https:// stackoverflow.com/a/51276033/356726
Process.Start("ms-settings:display");
RunDLL
解决方案似乎是一种解决方法:https://stackoverflow.com/a/58260947/356726
但是有机会在 Win Forms 中使用启动器吗?
感谢 emoacht,正如评论中指出的:
启动设置应用程序:https://learn.microsoft.com/en-us/windows/uwp/launch-resume/launch-settings-app
在桌面应用程序中调用 Windows 运行时 API:https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/desktop-to-uwp-enhance
对我来说,它至少需要目标操作系统版本 Windows 10: