Delphi InputBox for password entry?

Arthur picture Arthur · Feb 26, 2009 · Viewed 24k times · Source

Inputbox:

answer:=Inputbox('a','b','c');

works good, but I'm looking for a masked one, like a password box where you only see little stars instead of the typed characters.

Answer

Remy Lebeau picture Remy Lebeau · Jan 14, 2014

In XE2, InputBox() and InputQuery() were updated to natively support masking the TEdit input, although that feature has not been documented yet. If the first character of the APrompt parameter is set to any value < #32 then the TEdit.PasswordChar will be set to *, eg:

answer := InputBox('a', #31'b', 'c');