Wisamx
Wisamx

Reputation: 117

spy keyboard (how to get keyboard digets via C# win forms app)

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...

Upvotes: 0

Views: 1240

Answers (3)

Jon Egerton
Jon Egerton

Reputation: 41559

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.

Upvotes: 0

Cody Gray
Cody Gray

Reputation: 244812

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.

Upvotes: 1

Theun Arbeider
Theun Arbeider

Reputation: 5419

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

Upvotes: 0

Related Questions