开发者

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


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜