How to mask input with VBScript?

前端 未结 2 1902
星月不相逢
星月不相逢 2021-01-29 05:09

does anyone have an idea how to mask the InputBox in VBScript without using html (work security issues)? I\'m using windows 10. Thank you very much, any help is greatly apprecia

相关标签:
2条回答
  • 2021-01-29 05:30

    ES_PASSWORD Displays an asterisk (*) for each character typed into the edit control. This style is valid only for single-line edit controls. Windows XP: If the edit control is from user32.dll, the default password character is an asterisk. However, if the edit control is from comctl32.dll version 6, the default character is a black circle.

    To change the characters that is displayed, or set or clear this style, use the EM_SETPASSWORDCHAR message.

    So set the style for the contained edit box to password.

    There is some C source code here

    MSDN - How to Create a Single Line Edit Control


    Run batch script as admin during Maven build (gives a good example of a wrapped VBScript that can be used for this purpose).

    0 讨论(0)
  • 2021-01-29 05:53

    In VBScript you essentially have 2 options for masked input:

    • Using the console and a ScriptPW.Password object:

      Set oInput = CreateObject("ScriptPW.Password")
      WScript.StdOut.Write "Enter password: "
      pw = oInput.GetPassword
      
    • Using a custom HTML dialog.

    [Source]

    Masking input in the builtin InputBox dialog is not possible.

    0 讨论(0)
提交回复
热议问题