[Freeware] Low-level screen and keyboard control for console apps

  • Thread starter Michael A. Covington
  • Start date
M

Michael A. Covington

Inspired by some of Adam Nathan's published code, I've written a class that
gives you low-level control of the screen and keyboard in C# console apps:

http://www.ai.uga.edu/mc/Konsole.zip

You can sense keystrokes without reading them, read keystrokes without
waiting for Enter, read lines of input in the manner of passwords (echoing
each character as '*'), clear the screen, move the cursor around, change the
text color, and more.

See also: http://www.ai.uga.edu/mc/blog/index13.html

or http://www.ai.uga.edu/mc/blog/index.html#040313

(depending on the date, one or the other of these links will work).

Unlike other screen-and-keyboard routines, mine are totally well behaved
when input or output is redirected to a file. In that situation, they don't
affect the real screen or keyboard at all (as the case may be). Instead
they read or write the appropriate number of characters and do nothing else.

Enjoy!

--

Michael A. Covington - Artificial Intelligence Ctr - University of Georgia

"In the core C# language it is simply not possible to have an uninitialized
variable, a 'dangling' pointer, or an expression that indexes an array
beyond its bounds. Whole categories of bugs that routinely plague C and C++
programs are thus eliminated." - A. Hejlsberg, The C# Programming Language
 
M

Michael A. Covington

The server was down for a couple of brief periods today; if you tried to go
to any of these sites and couldn't get to them, try again now. Enjoy!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top