Is there a way to accept keystrokes through c# in a console app? Basically I want to apply macros/the f-keys to my program, thanks.

Yes, you need to subscribe your form to a key event.

Something like:

this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.KeyUpEvent);

public void KeyUpEvent(object sender, KeyEventArgs e){

//Code here to handle specific keys
}

Can alternative use KeyDown or KeyPress events instead of Keyup.

It's not a form though, it's a console app, any way to do it through a console app?

Ok but won't that require the user to type in "f9" or whatever then hit enter? I want to bypass that like you would in a form.

I've never used it, but console.readkey() might be what you are looking for.

Comments
bumping your rep since the OP has zero rep power

After doing some research on using console.readkey(), it turns out this is exactly what I needed! Thank god .net 1.1 isn't the standard anymore as things like this were very limited back then. Thanks again!

This question has already been answered. Start a new discussion instead.