是否可以在没有窗口的情况下使用Windows Raw Input API(即从控制台应用程序)? [英] Is it possible to use Windows Raw Input API without a window (ie from a console application)?
问题描述
是否可以在没有窗口的情况下使用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屋!