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.
drew.haley
0
Newbie Poster
Recommended Answers
Jump to PostYes, 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.
Jump to PostI've never used it, but console.readkey() might be what you are looking for.
All 7 Replies
InfiNate
1
Light Poster
drew.haley
0
Newbie Poster
InfiNate
1
Light Poster
drew.haley
0
Newbie Poster
InfiNate
1
Light Poster
scru
commented:
bumping your rep since the OP has zero rep power
+1
drew.haley
0
Newbie Poster
InfiNate
1
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.