Jump to content
Sign in to follow this  
GaryFrost

Change Password char on input box

Recommended Posts

GaryFrost

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
  • Like 1

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.