Information Security Stack Exchange is a question and answer site for information security professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

migrated from Apr 1 '12 at 4:03

This question came from our site for professional and enthusiast programmers.

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.… The only way to be 100% sure your keystrokes aren't being logged is to not use a computer. – David Mar 28 '12 at 18:16
up vote 0 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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