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

前端 未结 2 1124
故里飘歌
故里飘歌 2021-01-19 14:47

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

I\'ve tried using RegisterRawInputDevices but my message loops doesn\'

2条回答
  •  孤独总比滥情好
    2021-01-19 14:54

    That way I did it (not sure it is the most comfortable way...):

    I have started a thread (for the task of filling my input buffer). In this thread I have created a message-only window (its hidden, and can get input datas) with an appropriate window-class.

    Then registered the raw input devices.

    This thread has its own message handler loop. In the WindowProc of the window-class I've handled the inputs.

    (For buffer, You can use boost:circular_buffer, it ROCKS! :D)

    In this solution You did need have a window, but it looks like You don't. :)

    I hope this can help.

提交回复
热议问题