Firing a keyboard event

mooman_fl

Centurion
Joined
Nov 3, 2002
Messages
193
Location
Florida, USA
I got a little side-tracked today by another project idea. A minor one this time. What I want to do is create a program that monitors the most recent line added to a text file then perform a specific action based on what it found. All well and good so far. Easy as pie.

What I am not sure of since I have never had to do it is how to fire a keyboard event so that what even program is active at time assumes the buttons have been pressed on the keyboard itself.

Just for any curious people out there this is going to be used to automate another program I use frequently. This program will be minimized at time and only the program I want to automate will be in focus.

What would be the best way to go about this in .NET? I know this is probably a newbie question but I have never had to deal with anything like this before.
 
In VB you would use sendkeys to send keystrokes to the active application.

I’m trying to do the exact same thing right now, I’ve got the program written in VB.net using sendkeys. My problem is that the target program (everquest) is ignoring keystrokes sent via sendkeys:/. Might work for you though.
 
Hmmmm... not sure if that will suit my needs. Is there another way to do it that doesn't focus specifically on the app itself and just adds the keystrokes to a general message queue? So that any program recieves it as long as it is focused?
 
Back
Top