Question

I want to build a win app using C#... I want this app to accept letter from the keyboard... and I want that to be done either the text is written via this program or another... its will be much better if I can choose programs I want to spy on... in another words... I want my program to get every thing presses on the keyboard and everything is being written on firefox,opera,internet explorer witch are running at same time with my program...

Was it helpful?

Solution

I believe what you are looking for is a keylogger...

if so you can find information on: http://www.axino.net/tutorial/2009/02/keylogger-in-c-introduction

OTHER TIPS

You need a global keyboard hook, which will allow your application to listen in on keyboard input events system-wide. You implement this by P/Invoking the SetWindowsHookEx function and specifying the WH_KEYBOARD_LL flag for the idHook parameter. The entire process can get slightly complicated.

But it turns out that you're in luck. Stephen Toub has already written the code for you here on his blog: Low-Level Keyboard Hook in C#. Just drop this into your project and you're in the spy business.

There's a fairly comprehensive article on this over at Code Project: http://www.codeproject.com/KB/system/KeyLogger.aspx

While that article is based around C++ etc it covers a lot of the technical details you need to know.

There is an example C# project here: http://www.codeproject.com/KB/system/simple_key_log.aspx.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top