Capturing keyboard input without focusing on the program window

I am making a VoIP client and I want to start / stop the WM_KEYDOWN and WM_KEYUP messages for a specific input, for example K. When the main window has focus, it is np, but how to enable it outside the window? For example, if the window is not in focus and I just look at the desktop or I'm in a video game. How do you do something like that? I'm not sure where to start.

Besides - I think you should somehow poll every input even outside the program, is that expensive?

win32 c ++ btw

+3
source share
2 answers

You need to install keyboard hooks: http://msdn.microsoft.com/en-us/library/ms644990(v=VS.85).aspx

, , - .

+2

, - Word, K, , "k", .

Windows , , Alt, Ctrl. "" " ".

0

Source: https://habr.com/ru/post/1783266/


All Articles