Jump to content

Change Password char on input box


 Share

Recommended Posts

For those of you who wish to be different.

#include <GUIConstants.au3>


$gui_win = GUICreate("My GUI", 320,140, @DesktopWidth/2-160, @DesktopHeight/2-45)
$char = GUICtrlCreateInput ( "", 10,  5, 300, 20)
$input = GUICtrlCreateInput ("", 10,  35, 300, 20,$ES_PASSWORD)
$change = GUICtrlCreateButton ("Change", 40,  75, 60, 20)
$nopwdchar = GUICtrlCreateButton ("No PWD Char", 40,  100, 100, 20)
GUISetState () 

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
            Case $msg = $change
                $p_char = GUICtrlRead($char)
                If(StringLen($p_char) == 1) Then
                    _GUICtrlInputSetPasswordChar($input, $p_char)
                    ControlFocus($gui_win,"",$input)
                EndIf
            Case $msg = $nopwdchar
                    _GUICtrlInputSetPasswordChar($input, "", 0)
                    ControlFocus($gui_win,"",$input)
       EndSelect
Wend

Func _GUICtrlInputSetPasswordChar($h_wnd, $s_char, $i_mask=1)
    Const $EM_SETPASSWORDCHAR = 0xCC
    If($i_mask) Then
        GUICtrlSendMsg($h_wnd,$EM_SETPASSWORDCHAR,Asc($s_char),0)
    Else
        GUICtrlSendMsg($h_wnd,$EM_SETPASSWORDCHAR,0,0)
    EndIf
EndFunc
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...