是否可以在没有窗口的情况下使用Windows Raw Input API(即从控制台应用程序)? [英] Is it possible to use Windows Raw Input API without a window (ie from a console application)?

查看:357
本文介绍了是否可以在没有窗口的情况下使用Windows Raw Input API(即从控制台应用程序)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在没有窗口的情况下使用Windows Raw Input API(即从控制台应用程序)?

Is it possible to use Windows Raw Input API without a window (ie from a console application)?

我已经尝试过使用RegisterRawInputDevices,但是我的消息循环似乎没有从GetMessage中获取任何事件,因此只是挂起"了.

I've tried using RegisterRawInputDevices but my message loops doesn't seem to get any events from GetMessage and hence just 'hangs' there.

推荐答案

您的意思是 RegisterRawInputDevices ?

Do you mean RegisterRawInputDevices?

由于RAWINPUTDEVICE结构要求您指定HWND来接收WM_INPUT消息,所以没有窗口就不可能做到这一点.

Since the RAWINPUTDEVICE structure requires you to specify an HWND to receive the WM_INPUT messages, no it's not possible to do this without a window.

控制台应用程序可以创建窗口,并且该窗口在隐藏时可能会收到WM_INPUT,但是您确实需要一个窗口.

Console applications can create windows, and the window probably can receive WM_INPUT while hidden, but you do need a window.

这篇关于是否可以在没有窗口的情况下使用Windows Raw Input API(即从控制台应用程序)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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