C#

Moderators: None (Apply to moderate this forum)
Number of threads: 2722
Number of posts: 5749

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Sending Keystrokes to different process Posted by vickirk on 1 May 2009 at 7:42 AM
Hi,

I'll apologise in advance, I'm a java developer by trade and have been asked to do something in C#, I also now little about the windows API.

What I need to do is have an application that send preprogrammed key strokes to an application when a user invoke it. I'm anticapting a fairly straight forward form where the user selects something from a list and clicks a button, the keystrokes associated are sent to the window that was last active. I would also like to be able record keystrokes typed by the user to an application. I'm aware that macro software like this exists but this is just a small part of an application.

I have searched a bit but I just can't find anything applicable on msdn or elsewhere, it doesn't help when I don't know what I'm looking for. Can anyone point me to some relevant documentation or suggest something to look into?

Cheers, Vic


Report
Re: Sending Keystrokes to different process Posted by Psightoplazm on 1 May 2009 at 8:46 AM
The most common resolution I've seen for this is using SendKeys. I personally don't like this solution because it requires the application you are sending keystrokes to to have focus - but then the same case is true if you are using the win32 api to send strokes.

more info here

As far as monitoring keystrokes you will need to actually tap into the win32 api

use the GetAsyncKeyState method - but be warned - windows vista and many anti-viral programs will throw a fit because they will think you are a keyboard logger.

More info here
></\/~Psightoplasm`~
Report
Re: Sending Keystrokes to different process Posted by vickirk on 3 May 2009 at 3:36 AM
Thanks for the advice, it is greatly appreciated.

Cheers, Vic




Report
Re: Sending Keystrokes to different process Posted by zxzasa on 20 Jan 2011 at 8:26 AM
yu ma record keystrokes with http://www.protemac.com/keybag/
Report
Re: Sending Keystrokes to different process Posted by BlackhorseN on 22 Mar 2011 at 11:44 PM
record keystrokes? take a look at this keylogger for Mac/PC.


Mac keylogger

keylogger for Mac
Report
Re: Sending Keystrokes to different process Posted by tozmer on 4 May 2011 at 8:03 AM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.