在 Mono C# 中获取和设置 Num/Caps/Scroll-lock 状态

发布于 2024-08-21 19:46:02 字数 87 浏览 3 评论 0原文

Mono.Net 有没有办法获取和设置独立于平台的 Num/Caps/Scroll-lock 状态(Linux 和 Windows)?

提前致谢。

Is there a way in Mono.Net to get and set the Num/Caps/Scroll-lock status platform independent (Linux and Windows)?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

苏别ゝ 2024-08-28 19:46:03

Windows下使用GetKeyState的pinvoke签名,MSDN上关于GetKeyState 位于此处。至于单声道,我不确定。

如果 p/invoke 被用作 Linux 下的 Mono 并没有等效的 Win32 API,那么就不存在跨平台 API 之类的东西,请记住与 Win32 API 相关的整个练习是它们专门用于 Windows 系统,其中Linux没有!

要在 Linux 下真正实现 .NET 和 Mono 的平台独立性,需要不使用特定的 Win32 API 和 p/Invoke。

希望这有帮助,
此致,
汤姆.

Use the pinvoke signature for GetKeyState under Windows, the MSDN about GetKeyState is here. As for mono, I am not sure.

There is no such thing as a cross-platform API if p/invoke is used as Mono under Linux does not have a Win32 API equivalent, remember the whole exercise in relation to Win32 API's is that they are specifically for the Windows system, in which Linux does not have!

To be truly platform independant with .NET and Mono under Linux requires that no specific Win32 API's and p/Invokes are used.

Hope this helps,
Best regards,
Tom.

手心的温暖 2024-08-28 19:46:03

我不知道这是否是真正的 MONO,但在 .Net 控件中,您有 IsKeyLocked 方法。

I don't know if this is truly MONO, but in .Net controls you have the IsKeyLocked method.

拥醉 2024-08-28 19:46:02

.NET Console.CapsLock 和 NumberLock 属性返回按键状态。 Mono 也有它们,但尚未记录。尝试一下。

The .NET Console.CapsLock and NumberLock properties return the key state. Mono has them too, but they are not yet documented. Give it a try.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文