多个原始输入窗口接收器 [英] Multiple Raw Input Window Sinks

查看:95
本文介绍了多个原始输入窗口接收器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个仅消息窗口(ATL :: CWindowImpl),该窗口使用RIDEV_INPUTSINK标志将其自身注册为原始输入,这意味着无论该窗口是否为前景窗口,它都会获取所有输入.当该窗口只有一个实例时,这非常有用.

I have a message-only window (ATL::CWindowImpl) that registers itself for raw input using the RIDEV_INPUTSINK flag, meaning it gets all input regardless of whether the window is the foreground window. This works great when there's only one instance of that window.

但是,当我创建一个以上的窗口实例时,只有一个实例收到WM_INPUT消息(我当前正在创建两个实例,只有要创建的第二个实例可以获取消息).

However, when I create more than 1 instance of my window, only one receives the WM_INPUT messages (I'm currently creating two, and only the second one to be created gets the messages).

RegisterRawInputDevices(使用RIDEV_INPUTSINK | RIDEV_NOLEGACY)已成功完成.此外,未接收原始输入的窗口仍在接收其他消息,因此窗口本身不是问题...

RegisterRawInputDevices (using RIDEV_INPUTSINK | RIDEV_NOLEGACY) is succeeding during the creation of both windows. Also, the window not receiving raw input is still receiving other messages, so it's not a problem with the window itself...

如果相关,我正在使用VC11 beta,并创建了Windows,并在不同的线程上分配消息(使用std :: thread).

If it's relevant, I'm using the VC11 beta, and windows are created and dispatching messages on different threads (using std::thread).

这是否是API限制(即,每个进程只能使用一个输入接收器)?还是有办法使它正常工作?

Is this an API limitation (i.e. you are limited to one input sink per process)? Or is there a way to get this working?

谢谢.

现在,我当前的解决方法是只有一个窗口,然后将输入消息传递到其他窗口,但这很麻烦,在我希望它在其中工作的情况下,它是行不通的我有我的应用程序加载插件,它们可能需要原始输入,我不希望它们必须在我的应用程序中注册,除非我真的必须那样做...).

Right now my current workaround is to just have one window and for it to pass on the input messages to the other windows, however this is a mess, and won't work in the case I want it to work in (where I have my app loading plugins which may want raw input, I don't want them to have to register with my app unless I really have to do it that way...).

推荐答案

从MSDN(

From MSDN (here and here) the whole API for Raw Input talks always about application and not about window... which means that an application registering for raw input will be trated by the OS as one entitiy... which you indirectly proved by registering a second receiving winow - the first one just stopped receiving because the OS delivers raw input to the application (represented by exactly onw window as the sink).

这篇关于多个原始输入窗口接收器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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