Is it possible for other application running in the OS to read the keystrokes that my application uses?

What about mouse events and window handles?

Is there any security wall that the OS uses to shield my application from other potential dangerous applications that have might infiltrated into the machine?

Is there any difference between Windows in Mac in this issue?

Thank you

  • 1
    these are called keyloggers i believe..
    – deathApril
    Mar 28 '12 at 18:15
  • Good questions, but off-topic. These would be a better fit at Security.Stackexchange.Com As a side-note, yes, there are applicaitons as well as devices that can record keystrokes. There are also tools that can record keystrokes without software just by monitoring the electromagnetic emissions from your keyboard. en.wikipedia.org/wiki/… The only way to be 100% sure your keystrokes aren't being logged is to not use a computer. Mar 28 '12 at 18:16

One way this can be accomplished on Windows is by installing a message hook, which would allow you to spy on the keyboard messages in flight. This may require some level of access, and, for Vista and above--it may not be possible to see messages destined for processes at a higher integrity level--I've never tried.

Another method is to poll the keyboard with GetAsyncKeyState. I don't think there are any security precautions against that, though I'm not sure if it would work when the input is going to another desktop (like the secure desktop used for UAC prompts).

Both methods are pretty easy to detect.


the windows developer tool 'spyxx' can capture all windows messages, including keystrokes and mouse events of other applications, so it is certainly possible.

It uses SetWindowsHookEx.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.