How do you do masked password entry on windows using character overwriting?

Posted by Erick on Stack Overflow See other posts from Stack Overflow or by Erick
Published on 2010-03-16T20:59:07Z Indexed on 2010/03/16 21:01 UTC
Read the original article Hit count: 242

Filed under:
|
|
|

Currently I am using this implementation to hide user input during password entry:

void setEcho(bool enable) {
  HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
  DWORD mode;
  GetConsoleMode(hStdin, &mode);

  if(enable) {
    mode |= ENABLE_ECHO_INPUT;
  } else {
    mode &= ~ENABLE_ECHO_INPUT;
  }

  SetConsoleMode(hStdin, mode);
}

The user needs to be able to have positive feed back that text entry is being made. What techniques are available in a Win32 environment using C++?

© Stack Overflow or respective owner

Related posts about Windows

Related posts about c++