UWP中的鼠标和键盘挂钩:原始输入VS KeyEvents VS全局挂钩 [英] Mouse and Keyboard hooking in UWP : Raw input VS KeyEvents VS Global Hook

查看:86
本文介绍了UWP中的鼠标和键盘挂钩:原始输入VS KeyEvents VS全局挂钩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在UWP应用程序中挂上鼠标和键盘,我想知道

I'd like to hook mouse and keyboard in my UWP app, and I'm wondering what is best between Raw input, Global Hook and simple XAML Key events.

很简单,我正在开发一个UWP应用程序,该应用程序流游戏(使用nVidia Grid之类的云服务器渲染),并且我想钩住用户事件(键盘和鼠标)以告诉我的服务器用户在游戏中移动(例如).

Put it simple, I'm developing a UWP application which streams a game (rendered using a cloud server, like nVidia Grid) and I'd like to hook user events (keyboard and mouse) to tell my server the user is moving in a game (for example).

我想到了几种方法:

  • 在C ++/CX中创建Windows运行时组件,该组件由我在C#中的通用应用消耗.该组件将使用Raw Input或Global钩子引发鼠标或键盘事件,并将其发送回我的UWP应用.
  • 只需在网格或其他UI元素上使用Key事件(例如KeyDown和PointerMoved事件)并收听即可.

输出将使用套接字连接发送到我的服务器.

The output will be sent to my server using a socket connection.

什么是性能和简单性的最佳解决方案?

What would be the best solution for performance and simplicity?

推荐答案

似乎只有按键事件才允许在UWP中挂接输入.

It seems only Key Events are allowed to hook input in UWP.

这篇关于UWP中的鼠标和键盘挂钩:原始输入VS KeyEvents VS全局挂钩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆