Comments

  1. Saturday, February 09, 2008 12:17:11 AM by Bill
    This is handy. I needed a masked input field, so it saved me some work.

    The ReadKey method returns both character keystrokes (letters, numbers, etc.) and function keystrokes (function keys, cursor movement keys, etc.). Since function keys don't actually provide characters that could be part of a password, it would be best to filter them out, but unfortunately, the ConsoleKeyInfo structure does not provide a property to classify whether a keystroke is a character or function key. The documentation does say that the KeyChar property provides the character *if one is available*. It turns out that if one is not available, KeyChar is set to the "zero" value of a character - the same thing you'd get if you did "(char)0" or "new char()". I put in a test for that and it seems to be filtering appropriately.
  2. Wednesday, September 24, 2008 2:48:40 PM by David
    really handy. I'm gonna use it (personal use) for a small utility to unlock BitLocked volumes in W2k8

    Thanks!
  3. Friday, January 30, 2009 11:36:13 PM by Lars Brandt
    Great! Thanks for the post.
  4. Friday, July 31, 2009 9:23:41 AM by tjrobinson
    Great code and explanation, thanks
  5. Friday, October 02, 2009 3:08:53 PM by Lukasz
    it doesn't work with Hi-ASCII nor DBCS because console is not utf8
Add Comment