This works:
Changing the order of ConsoleMode_AND_WITH calls produces the "Requires ENTER key" behaviour before anything shows up.use Win32::Console ; $cons = new Win32::Console(STD_INPUT_HANDLE) || die "Can't open new co +nsole\n"; $|++; # Disable buffering on STDOUT. ConsoleMode_AND_WITH (~(ENABLE_ECHO_INPUT));# ConsoleMode_AND_WITH ( ~(ENABLE_LINE_INPUT));# while (1) { $char = $cons->InputChar(1) ; last if ord $char == 13 ; print '*' ; $password .= $char ; } print "\nPassword was $password\n" ; $cons->Mode($oldMode) ; sub ConsoleMode_AND_WITH(){ my $o = $cons->Mode(); $cons->Mode($o & shift); print "--Mode change from $o\[" . unpack(q(H2),chr($o)) . " ] to " . $cons->Mode() . "[". unpack(q(H2),chr($cons->Mode())) . "]\n"; }
MS documentation says ENABLE_LINE_INPUT OFF should ignore the setting of ENABLE_ECHO_INPUT. But this is probably getting off-topic. Anyway, the code above does what you require, as does Browser's.
In reply to Re: Win32::Console Modes not Working on XP
by NetWallah
in thread Win32::Console Modes not Working on XP
by playingwithbots
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |