Jump to content
Sign in to follow this  
Emiel Wieldraaijer

Toggle $ES_PASSWORD

Recommended Posts

Emiel Wieldraaijer

Hi All,

is it possible to toggle $ES_PASSWORD on/off

i couldn't find anything about it

Thnx

Emiel


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites
ChrisL

I'm not sure you can I tried setting the style with GuiCtrlSetStyle() and it didn't work but the help file says some styles can not be changed once set. The other way you could do it is to delete the control and recreate it.

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 170,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_1 = GuiCtrlCreateInput("", 10, 20, 320, 30)
$Button_2 = GuiCtrlCreateButton("Password", 20, 120, 140, 30)
$Button_3 = GuiCtrlCreateButton("Plain", 220, 120, 140, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_2
        
    GuiCtrlDelete($Input_1)
    $Input_1 = GuiCtrlCreateInput("", 10, 20, 320, 30,$ES_PASSWORD)

    Case $msg = $Button_3
        
    GuiCtrlDelete($Input_1)
    $Input_1 = GuiCtrlCreateInput("", 10, 20, 320, 30)
    
    Case Else
    ;;;
    EndSelect
Wend

Share this post


Link to post
Share on other sites
SmOke_N

I would imagine that EM_SETPASSWORDCHAR + SendMessage + ControlFocus after the call would change it.

Edit:

Guess this is a good reason why I "Imagined" it:

http://www.autoitscript.com/forum/index.ph...SETPASSWORDCHAR

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Emiel Wieldraaijer

@SmOke_N

thnx for pointing me into the right direction

Show Password

GUICtrlSendMsg($PasswordField,0xCC,0,0)

GUICtrlSetState($PasswordField, @SW_UNLOCK)

Hide Password

GUICtrlSendMsg($PasswordField, 0xCC, Asc("*"), 0)

GUICtrlSetState($PasswordField, @SW_UNLOCK)

Should do the trick

@ChrisL

i believe deleting an recreating the field will also do the trick .. i haven't tried .. thnx anyway


Best regards,Emiel Wieldraaijer

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  

×