.NET WinForm 应用程序如何区分本地击键和来自 Ultra VNC 服务器的击键?

发布于 2024-10-06 05:52:41 字数 207 浏览 1 评论 0原文

我在 .NET 2.0 和 XP 上有一个 C# WinForm 应用程序。还有一个 UltraVNC 服务器与我的应用程序运行在同一台 PC 上。用户可以在 PC 上本地访问该应用程序,也可以通过 UltraVNC 服务器远程访问该应用程序。

当应用程序中的某些文本框收到击键时,应用程序想知道击键是来自本地键盘还是来自 UltraVNC 服务器。这可能吗?鼠标点击也是同样的问题。

I have a C# WinForm application on .NET 2.0 and XP. There is also an UltraVNC server running on the same PC as my application does. The user may access the application either locally at the PC or remotely via the UltraVNC server.

When some textboxes in the application receive a keystroke, the application would like to know if the keystroke is from the local keyboard or from the UltraVNC server. Is this possible? Also the same question for mouse clicks.

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

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

发布评论

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

评论(2

弃爱 2024-10-13 05:52:41

它不会区分击键,但您可以通过以下方式检测 RDP 会话:

System.Windows.Forms.SystemInformation.TerminalServerSession

It won't disinguish the key-strokes, but you may be able to detect the RDP session via:

System.Windows.Forms.SystemInformation.TerminalServerSession
懒猫 2024-10-13 05:52:41

通过设置低级键盘挂钩,您可以检查事件中的 LLKHF_INJECTED 标志。如果设置了此标志,则击键已由其他应用程序(即 Teamviewer、VNC 服务器或使用 SendInput() 或已弃用的 keybd_event() 的其他应用程序)注入。否则,它可能来自可靠的来源(键盘驱动程序或 Microsoft 远程桌面会话)。请参考MSDN了解有关此标志的更多信息。

By setting a low level keyboard hook, you may check for the LLKHF_INJECTED flag in the event. If this flag is set, then the keystroke has been injected by other application (i.e. Teamviewer, VNC servers or other applications using SendInput() or the deprecated keybd_event()). Else, it probably came from a reliable source (the keyboard driver or a Microsoft Remote Desktop session). Please refer to MSDN to know more about this flag.

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