Ich habe im CodeArchiv ein Codeschnipsel von Talun gefunden, mit dem ich in einer Konsole eine Passwort eingabe erzwingen konnte. Ich fand den Schnipsel aber etwas unkomfortable und nicht ausrecihend darum habe ich ihn "etwas" erweitert. Ich würd mich über ein Kommentar, wie ihr es findet freuen

Code: Alles auswählen
Procedure.s GetPWDInput(strMark.s, bytNewLine.b)
DefType.s strEingabe, strInputPWD
DefType.l lngStdOut
DefType.CONSOLE_SCREEN_BUFFER_INFO KonsoleInfo
CharToOEM_(@strMark, @strMark)
Repeat
strEingabe = Inkey()
If Len(strEingabe) <> 0
Select Asc(strEingabe)
Case 8
If Len(strInputPWD) <> 0
GetConsoleScreenBufferInfo_(GetStdHandle_(#STD_OUTPUT_HANDLE), @KonsoleInfo)
strInputPWD = Mid(strInputPWD, 1, Len(strInputPWD)-1)
If Len(strMark) <> 0
ConsoleLocate(KonsoleInfo\dwCursorPosition\x-1, KonsoleInfo\dwCursorPosition\y)
Print(" ")
ConsoleLocate(KonsoleInfo\dwCursorPosition\x-1, KonsoleInfo\dwCursorPosition\y)
EndIf
EndIf
Case 13
Break
Case 27
strInputPWD = ""
Break
Default
If Asc(strEingabe) >= 32 And Asc(strEingabe) < 128
strInputPWD + Left(strEingabe, 1)
Print(strMark)
EndIf
EndSelect
EndIf
Delay(1)
ForEver
If bytNewLine = #True: PrintN(""): EndIf
ProcedureReturn strInputPWD
EndProcedure
If OpenConsole()
PrintN("Bitte geben Sie ein Passwort ein (ESC für abbrechen): ")
PrintN(GetPWDInput("•", #True))
PrintN(GetPWDInput("*", #True))
PrintN(GetPWDInput("#", #True))
PrintN(GetPWDInput("", #True))
EndIf
End
Edit2: Gott hate ich da n miesen Codestill
