Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a Program Differentiate between User Key Input and Program key Input?

Is it possible for a program to block key input from other programs but NOT key input directly from the user's hand hitting a key on the keyboard?

For example:

ProgramA contains a text field .

ProgramB is Windows On-Screen keyboard.

After selecting the text field in ProgramA, I attempt to press the letter 'c' on the On-Screen Keyboard program but it does not appear in the text field.

However, when I press the letter 'c' directly from my keyboard it appears within the text field of ProgramA.

I know how key events work, how they are queued, and I've seen the BlockInput Function in c++

http://msdn.microsoft.com/en-us/library/windows/desktop/ms646290%28v=vs.85%29.aspx

But that function simply blocks all input.

Ive encountered programs that filter the input in this way and can't seem to figure out how. Am I missing something completely obvious?

This question is mainly pertaining to c++ on the Windows 7 operating system.

like image 663
user2212942 Avatar asked Mar 26 '13 19:03

user2212942


1 Answers

You can never be sure if input is coming from hardware. The simplest example is a custom driver wich will simulate real keyboard driven by software input.

Some fancy idea can be attaching microphone to device, to listen for sounds/vibrations for input filtering, but do you mean complete hardware solution or application, wich will be given to personal users?

like image 131
Piotr Müller Avatar answered Oct 04 '22 23:10

Piotr Müller