Jump to content

Length Limitations of $ES_PASSWORD


Recommended Posts

I'm coding a login box that takes a username and password and maps network drives. Everything works fine but when certain users with long passwords (approximately 25 characters or more) log in, they are unable to because the password does not fit.

The code that creates the password box currently looks like this:

$thepasswordfield = GUICtrlCreateInput("",75,60,150,20,$ES_PASSWORD)

I've set up a test in which I have a dialog box containing the password pop up after the users click the "Login" button. This produces very different results when the $ES_PASSWORD flag is present and when it is absent. When I don't include it in my GUICtrlCreateInput statement, the correct password shows up in the dialog box but the password is unmasked in the input field. When I do include it, the password is masked in the input field but the dialog box displays a truncated password.

Is there any way to increase the maximum length of the input field when the $ES_PASSWORD flag is present? Thank you!

Link to comment
Share on other sites

Hm, I have no problems with this sample code:

GUICreate("Test")
$Pwd = GUICtrlCreateInput("", 10, 10, 300, 20, 0x0020)
GUISetState()

Local $msg
Do
 $msg = GUIGetMsg()
 If $msg = $Pwd Then ConsoleWrite(GUICtrlRead($Pwd))
Until $msg = -3

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

Okay, I see what's going on. Since I have hard-coded the width in at 150, this is limiting the number of characters that can be typed into the field somehow. I want it to appear to be 150 long, but the one in your example is 300 long and therefore has a longer limit.

So, my new question is such: is there any way of making the actual length of the field longer while keeping the appearance small?

Hm, I have no problems with this sample code:

GUICreate("Test")
$Pwd = GUICtrlCreateInput("", 10, 10, 300, 20, 0x0020)
GUISetState()

Local $msg
Do
 $msg = GUIGetMsg()
 If $msg = $Pwd Then ConsoleWrite(GUICtrlRead($Pwd))
Until $msg = -3

Link to comment
Share on other sites

Use $ES_AUTOHSCROLL

GUICreate("Test")
Local $hPwd = GUICtrlCreateInput("", 10, 10, 150, 20, BitOR(0x0020, 0x0080))
GUISetState()

Local $msg, $pwd
Do
 $msg = GUIGetMsg()
 If $msg = $hPwd Then
  $pwd = GUICtrlRead($hPwd)
  ConsoleWrite(StringLen($pwd) & " - " & $pwd & @CR)
 EndIf
Until $msg = -3

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

I guess I should clarify here. I'd really like to have an input box of unlimited length that has the $ES_PASSWORD flag. Unfortunately, when I set the $ES_PASSWORD flag, the box seems to be limited by the length of the physical input box as it appears on the screen. Is there any way to remove this limitation? Some people have some very long passwords and having a text field that takes up most of the screen is impractical. Thank you!

Link to comment
Share on other sites

Thank you so much! This fixed the problem entirely!

Use $ES_AUTOHSCROLL

GUICreate("Test")
Local $hPwd = GUICtrlCreateInput("", 10, 10, 150, 20, BitOR(0x0020, 0x0080))
GUISetState()

Local $msg, $pwd
Do
 $msg = GUIGetMsg()
 If $msg = $hPwd Then
  $pwd = GUICtrlRead($hPwd)
  ConsoleWrite(StringLen($pwd) & " - " & $pwd & @CR)
 EndIf
Until $msg = -3

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...