Jump to content

Autoit password style


Go to solution Solved by Melba23,

Recommended Posts

  • Moderators
  • Solution

1stPK,

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Here one approach (don't know if there is a better way) :

#include <GUIConstants.au3>
#include <WinAPIGdi.au3>

GUICreate("Login", 200, 100)

GUICtrlCreateLabel("", 10, 10, 180, 19, $SS_BLACKFRAME)
GUICtrlSetState(-1, $GUI_DISABLE)
Local $idInput = GUICtrlCreateInput("", 13, 11, 154, 17, $ES_PASSWORD, $WS_EX_TOOLWINDOW)
Local $idEye = GUICtrlCreatePic("Hide.bmp", 167, 11, 21, 17), $bHide = True
Local $iDefault = GUICtrlSendMsg($idInput, $EM_GETPASSWORDCHAR, 0, 0)

GUISetState()

While True
  Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
      Exit
    Case $idEye
      $bHide = Not $bHide
      GUICtrlSetImage($idEye, $bHide ? "Hide.bmp": "Show.bmp")
      GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, $bHide ? $iDefault : 0, 0)
      _WinAPI_RedrawWindow(GUICtrlGetHandle($idInput))
  EndSwitch
WEnd

bmp here Eye.zip

Edited by Nine
Link to comment
Share on other sites

WEBDINGS have an Eye icon so the BMP's arent needed.

#include <GUIConstants.au3>
#include <WinAPIGdi.au3>
#include <FontConstants.au3>

GUICreate("Login", 200, 100)

GUICtrlCreateLabel("", 10, 10, 180, 19, $SS_BLACKFRAME)
GUICtrlSetState(-1, $GUI_DISABLE)
Local $idInput = GUICtrlCreateInput("", 13, 11, 154, 17, $ES_PASSWORD, $WS_EX_TOOLWINDOW)
Local $idEye2 = GUICtrlCreateLabel(ChrW(0x4E), 170, 11, 18, 17), $bHide = True
GUICtrlSetFont($idEye2, 14, $FW_NORMAL, $GUI_FONTSTRIKE, "WEBDINGS")
Local $iDefault = GUICtrlSendMsg($idInput, $EM_GETPASSWORDCHAR, 0, 0)

GUISetState()

While True
  Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
      Exit
    Case $idEye2
      $bHide = Not $bHide
         GUICtrlSetFont($idEye2, 14, $FW_NORMAL, $bHide ? $GUI_FONTSTRIKE : $GUI_FONTNORMAL, "WEBDINGS")
         GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, $bHide ? $iDefault : 0, 0)
      _WinAPI_RedrawWindow(GUICtrlGetHandle($idInput))
  EndSwitch
WEnd

 

Some guy's script + some other guy's script = my script!

Link to comment
Share on other sites

#include <GUIConstants.au3>
#include <WinAPIGdi.au3>
#include <FontConstants.au3>
#include <ColorConstants.au3>

GUICreate("Login", 200, 100)

GUICtrlCreateLabel("", 10, 10, 180, 19, $SS_BLACKFRAME)
GUICtrlSetState(-1, $GUI_DISABLE)
Local $idInput = GUICtrlCreateInput("", 13, 11, 157, 17, $ES_PASSWORD, $WS_EX_TOOLWINDOW)
Local $idEye2 = GUICtrlCreateLabel(ChrW(0x4E), 170, 11, 18, 17), $bHide = True
GUICtrlSetFont($idEye2, 14, $FW_NORMAL, $GUI_FONTNORMAL, "WEBDINGS")
GUICtrlSetBKColor($idEye2, $COLOR_WHITE)
Local $idEye3 = GUICtrlCreateLabel("/", 175, 9, 18, 17), $bHide = True
GUICtrlSetFont($idEye3, 16, $FW_BOLD, $GUI_FONTITALIC, "")
GUICtrlSetColor($idEye3, $COLOR_RED)

GUICtrlSetBKColor($idEye3, -2)

Local $iDefault = GUICtrlSendMsg($idInput, $EM_GETPASSWORDCHAR, 0, 0)

GUISetState()

While True
  Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
      Exit
    Case $idEye2
      $bHide = Not $bHide
         GUICtrlSetState ($idEye3, $bHide ? $GUI_SHOW : $GUI_HIDE)
         GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, $bHide ? $iDefault : 0, 0)
      _WinAPI_RedrawWindow(GUICtrlGetHandle($idInput))
  EndSwitch
WEnd

:)

Edited by Werty

Some guy's script + some other guy's script = my script!

Link to comment
Share on other sites

If you insist of not having bmp files, here a better script :

#include <GDIPlus.au3>
#include <GUIConstants.au3>
#include <WinAPIGdi.au3>
#include <String.au3>

Login()

Func Login()
  _GDIPlus_Startup()

  Local $hImageHide = _GDIPlus_BitmapCreateHBITMAPFromBitmap(_ConvertStringToImage1(21, 17))
  Local $hImageShow = _GDIPlus_BitmapCreateHBITMAPFromBitmap(_ConvertStringToImage2(21, 17))

  GUICreate("Login", 200, 100)

  GUICtrlCreateLabel("", 10, 10, 180, 19)
  GUICtrlSetState(-1, $GUI_DISABLE)
  GUICtrlSetBkColor(-1, 0x86BEEF)
  GUICtrlCreateLabel("", 11, 11, 178, 17)
  GUICtrlSetState(-1, $GUI_DISABLE)
  GUICtrlSetBkColor(-1, 0xFFFFFF)
  Local $idInput = GUICtrlCreateInput("", 14, 11, 154, 17, $ES_PASSWORD, $WS_EX_TOOLWINDOW)
  Local $idEye = GUICtrlCreatePic("", 168, 11, 21, 17), $bHide = True
  Local $iDefault = GUICtrlSendMsg($idInput, $EM_GETPASSWORDCHAR, 0, 0)
  GUICtrlSendMsg($idEye, $STM_SETIMAGE, $IMAGE_BITMAP, $hImageHide)

  GUISetState()

  While True
    Switch GUIGetMsg()
      Case $GUI_EVENT_CLOSE
        ExitLoop
      Case $idEye
        $bHide = Not $bHide
        GUICtrlSendMsg($idEye, $STM_SETIMAGE, $IMAGE_BITMAP, $bHide ? $hImageHide : $hImageShow)
        GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, $bHide ? $iDefault : 0, 0)
        _WinAPI_RedrawWindow(GUICtrlGetHandle($idInput))
    EndSwitch
  WEnd
  _GDIPlus_Shutdown()

EndFunc   ;==>Login

Func _ConvertStringToImage1($iWidth, $iHeight)
  Local Const $IMAGE = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFFFFFFFFFEFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFD9DADAFF676868FFC8C8C9FFFDFEFFFFFEFDFFFFFFFEFDFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFCFEFFFFE6E7E9FFAEAFB1FF727375FF57585AFF565759FF5F6062FF8B8D8EFFD0D1D3FFDDDEE0FF565759FF797A7CFFD9DBDCFFFCFDFFFFFDFDFFFFFFFEFDFFFDFFFFFFFFFFFFFFFDFFFFFFFDFFFFFFE2E4E5FF8D8F90FF515254FF545657FF6F7172FF848687FF8A8B8DFF7D7F80FF696B6CFF46484AFF4B4D4EFF7E8081FFD0D1D3FFF4F5F7FFFBFCFEFFFDFDFFFFFFFFFEFFFEFFFFFFFFFFFFFFFCFDFDFFB8B9BAFF6F7070FF606061FF7B7B7CFFA3A4A5FFB0B1B1FF8D8E8EFF848585FFA2A3A3FFA2A3A3FF030304FF6E6F6FFFBFC0C0FFA6A6A7FFE0E1E1FFFDFEFEFFFFFFFFFFFFFEFCFFFFFFFFFFFEFEFEFFB4B4B4FF4D4D4DFF626262FFB3B3B3FFEBEBEBFFC6C6C6FF747474FF5F5F5FFF6B6B6BFF5D5D5DFF717171FF666666FFDFDFDFFFE2E2E2FF515151FF828282FFDDDDDDFFFEFEFEFFFFFFFDFFFFFFFFFFDCDCDCFF4A4A4AFF585858FFCECECEFFFFFFFFFFDEDEDEFF777777FF474747FF9E9E9EFF9D9D9DFF242424FF636363FFE3E3E3FFFCFDFDFFFEFEFEFF898989FF3E3E3EFF979797FFECECECFFFFFFFDFFFEFFFFFF7A7A7AFF505050FFD0D0D0FFFEFFFFFFFFFFFFFFA7A8A8FF5D5D5DFF9B9C9CFFD8D9D8FF818181FF5E5E5EFFD6D6D6FFB5B6B6FFFAFAFAFFFEFFFFFFFEFFFFFF7D7E7EFF5E5E5EFFBBBBBBFFFFFEFCFFFDFFFFFF424443FF898B8BFFE5E7E6FFFCFEFEFFFCFEFEFF999B9BFF616363FF969797FF838585FF5E605FFFD4D6D6FFABACACFF353737FFEEF0F0FFFEFFFFFFFEFFFFFFB9BABAFF545555FF9F9F9FFFFFFFFEFFFDFFFFFFB7B9B9FF2A2C2CFF9C9F9EFFEBEEEDFFFCFEFEFFBCBEBEFF565958FF222424FF5B5D5DFFD7DADAFFB9BCBBFF2F3131FF818483FFF0F2F2FFFEFFFFFFD6D9D8FF444646FF6F7171FFDADBDBFFFFFFFEFFFDFFFFFFFFFFFFFF797C7BFF1D201FFF969998FFE9EBEBFFCDCFCFFF676969FF5B5D5DFFD4D6D6FFABAEADFF2F3131FF2B2E2DFFFCFEFEFFE5E8E8FFE1E3E3FF393C3BFF3F4141FFBDBFBFFFFDFEFEFFFFFFFEFFFEFFFFFFFEFFFFFFFBFDFDFF888989FF242525FF575958FF494B4AFF646565FFE4E5E5FFBFC0C0FF3E3F3FFF868787FFF8F9F9FFF7F8F8FFB2B3B3FF232424FF4B4C4CFFCDCECEFFFEFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFEFEFFFFFFFFFFFAF9F9FFACABABFF3B3A3AFF706E6FFFD1D0D0FFC7C6C6FFBCBBBBFFD5D4D4FFB8B7B7FF737272FF111010FF0D0C0CFF9B9A9AFFEDECECFFFEFCFDFFFEFEFEFFFFFFFFFFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFFFFDBDADAFF4F4E4EFF757373FFDCDBDBFFB5B3B3FF484747FF232222FF1D1C1CFF2F2D2DFF5C5B5BFFA6A4A4FFDBDADAFFF2F1F1FFFEFCFDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFFFF696969FF7D7D7DFFD2D1D1FFFBFAFAFFF0F0F0FFDBDBDBFFD4D4D4FFD3D3D3FFD9D8D8FFE5E4E4FFEFEFEFFFFDFDFDFFFEFEFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFFFFD4D4D3FFE2E2E1FFFAFAFAFFFFFFFEFFFEFEFDFFFEFEFDFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFDFFFFFFFFFFFEFEFDFFFFFFFEFFFDFDFCFFFFFFFEFFFFFFFFFFFFFFFEFFFFFFFCFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFEFEFCFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFEFFFEFEFCFFFFFFFFFFFFFFFFFFFEFEFCFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFF"
  Return _ReadImageFromText($IMAGE, $iWidth, $iHeight)
EndFunc   ;==>_ConvertStringToImage1

Func _ConvertStringToImage2($iWidth, $iHeight)
  Local Const $IMAGE = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8FFFFFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFCFEFEFFFDFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFFFFFDFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFEFFFFFFFFFFFFFFECECECFFB1B2B2FF6F7070FF4F4F4FFF4D4E4EFF545555FF898989FFDDDDDDFFFBFBFBFFFDFEFEFFFDFEFEFFFDFEFEFFFDFEFEFFFDFEFEFFFFFFFDFFFFFFFEFFFEFEFDFFFEFEFDFFFCFDFCFFFDFEFDFFA7A8A7FF5B5C5CFF545554FF6E6F6EFF8D8E8EFF979797FF7F8080FF5B5C5CFF4B4C4BFF6C6C6CFFE7E8E7FFFDFEFDFFFCFDFCFFFCFDFDFFFEFEFEFFFFFFFDFFFFFFFEFFFEFEFCFFFDFEFCFFDEE0DEFF919391FF525452FF676967FFA1A3A2FFA1A3A2FF767877FF6F7170FF818381FFB0B3B1FF868987FF444644FF696C6AFFC1C3C1FFF3F3F3FFFEFEFEFFFEFEFEFFFFFFFDFFFEFFFDFFFCFDFBFFD7D8D6FF7C7E7CFF5F615FFF8D908DFFD0D2D0FFBEC1BEFF727471FF575957FF5E605EFF575957FF858885FFEDEFEDFFADAFADFF696C69FF626362FFAFB0AFFFECECECFFFFFFFFFFFFFFFDFFFEFFFDFFE6E7E5FF757674FF5D5E5BFFB1B3B0FFF1F3F0FFCACBC9FF686967FF5D5E5BFFBABBB8FFD4D6D3FF989997FF373836FF9A9B99FFF3F4F1FFDFE0DEFF797978FF5C5C5CFFB1B1B1FFF3F3F3FFFFFFFEFFFEFFFDFF8E8F8CFF41423FFFBBBCBAFFF7F7F5FFFCFDFBFF888986FF50514FFFB8B8B6FFFCFDFBFFFCFDFBFFECEDEAFF8D8D8BFF1C1C1AFFECEDEAFFFEFEFCFFEEEEECFF696968FF656464FFC7C7C7FFFFFFFCFFFEFFFDFF484946FF676866FFD4D4D2FFFAFBF8FFFBFCFAFF7E7E7CFF575855FFD3D3D1FFFFFFFDFFFFFFFDFFF3F4F1FFACADAAFF090A07FFECEDEAFFFFFFFDFFF9FAF7FF9E9D9CFF514F4EFFA7A6A4FFFFFFFBFFFFFFFDFFD0D1CFFF3F3F3DFF919290FFDEDFDDFFF8F8F6FF9FA09EFF555553FF939391FFEAEAE8FFF2F3F0FFD1D2D0FF5B5B59FF4A4B49FFF1F1EFFFF4F5F3FFC4C4C2FF4D4C4AFF8E8C8AFFEBE9E7FFFFFFFBFFFFFFFDFFFFFFFEFFBABBB8FF3E3E3CFF7B7C7AFFD3D3D1FFECEDEAFF8F908DFF3C3D3BFF868684FFABACA9FF646562FF2A2A28FFE6E7E5FFEBECE9FFB7B7B5FF383836FF7E7D7AFFE0DFDCFFFFFFFEFFFFFFFBFFFEFEFCFFFCFDFBFFFFFFFEFFCDCDCCFF424341FF373735FFA9A9A7FFF5F6F4FFB1B1B0FF2E2F2DFF181917FF535351FFF4F5F3FFF7F7F5FF666765FF171816FF979794FFEDECE8FFFFFFFCFFFFFFFDFFFFFFFBFFFFFFFEFFFFFFFEFFFFFFFEFFFCFDFCFFF8F8F7FF737373FF151514FF383837FF919291FFDBDBDAFFE8E8E7FFC1C1C1FF676867FF0C0C0BFF1B1B1AFFCECECDFFF7F7F5FFFEFDFAFFFFFFFDFFFFFFFDFFFFFFFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEDEDEDFFCDCDCDFF898989FF393939FF181818FF181818FF1F1F1FFF545454FFB9B9B9FFE2E2E1FFF9F9F8FFFEFEFCFFFFFFFDFFFFFFFEFFFFFFFDFFFFFFFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFAFAFAFFEBEBEBFFD8D8D8FFD1D1D1FFCFCFCFFFD1D1D1FFDEDEDEFFF5F6F6FFFEFEFEFFFEFEFDFFFDFDFCFFFEFDFBFFFFFEFCFFFFFFFDFFFFFFFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFCFDFCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFCFBFFFEFEFDFFFFFEFDFFFEFDFBFFFFFEFDFFFFFFFCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFEFEFFFEFEFDFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFEFFFEFEFCFFFEFEFDFFFEFEFDFFFEFEFEFFFDFEFEFFFFFEFCFF"
  Return _ReadImageFromText($IMAGE, $iWidth, $iHeight)
EndFunc   ;==>_ConvertStringToImage2

Func _ReadImageFromText($sString, $iWidth, $iHeight, $bFileName = False)
  ; Recreate image from text
  If $bFileName Then $sString = FileRead($sString)
  Local $dData = Binary("0x" & $sString)
  Local $tByte = DllStructCreate("byte string[" & $iWidth * $iHeight * 4 & "]")
  DllStructSetData($tByte, "string", $dData)
  Return _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $GDIP_PXF32ARGB, $iWidth * 4, DllStructGetPtr($tByte))
EndFunc   ;==>_ReadImageFromText

 

Link to comment
Share on other sites

19 hours ago, Nine said:

If you insist of not having bmp files,

But...that's cheating! :D

I'll refrain from making one with an animated Eye of Sauron. :)

Some guy's script + some other guy's script = my script!

Link to comment
Share on other sites

#include <GUIConstants.au3>
#include <WinAPIGdi.au3>

GUICreate("Login", 200, 100)

GUICtrlCreateLabel("", 10, 10, 180, 19, $SS_BLACKFRAME)
GUICtrlSetState(-1, $GUI_DISABLE)
Local $idInput = GUICtrlCreateInput("123456", 13, 11, 154, 17, $ES_PASSWORD, $WS_EX_TOOLWINDOW)
Local $idEye = GUICtrlCreateLabel("👁", 167, 11, 21, 17, $SS_CENTERIMAGE), $bHide = True
GUICtrlSetFont(-1, 14, 400, 0)
Local $iDefault = GUICtrlSendMsg($idInput, $EM_GETPASSWORDCHAR, 0, 0)

GUISetState()

While True
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idEye
            $bHide = Not $bHide
            GUICtrlSetFont(-1, 14, 400, $bHide ? 0 : 8)
            GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, $bHide ? $iDefault : 0, 0)
            _WinAPI_RedrawWindow(GUICtrlGetHandle($idInput))
    EndSwitch
WEnd
Edited by ioa747

I know that I know nothing

Link to comment
Share on other sites

The OP idea is to have the iconic "eye-slash" / "eye" looking like font in the control -also my wish-. But a strikethrough should be understandable too as far as symbolism. 

Edited by argumentum
remove external graphic

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

Now using @Werty's code as a base:

#include <GUIConstants.au3>
#include <WinAPIGdi.au3>
#include <FontConstants.au3>
#include <ColorConstants.au3>
#include <SendMessage.au3>
#include <WinAPISysWin.au3>

Global $g__sEyeSlashsFontname, $g__hEyeSlashsFontHandle = _LoadFont_EyeSlashs($g__sEyeSlashsFontname) ; code tested on WinXP, 10 and 11. 32bit & 64bit

Example()
Func Example()
    Local $hGui = GUICreate("Login", 200, 90)
    Local $idInputA, $idEyeShwnA, $idEyeHddnA, $bHideA, $idInputB, $idEyeShwnB, $idEyeHddnB, $bHideB, $idInputC, $idEyeShwnC, $idEyeHddnC, $bHideC
    _PasswordInput_GUICtrlsCreate($idInputA, $idEyeShwnA, $idEyeHddnA, $bHideA, ChrW(0xE917), ChrW(0xE918), 10, 10, 180)
    _PasswordInput_GUICtrlsCreate($idInputB, $idEyeShwnB, $idEyeHddnB, $bHideB, ChrW(0xE9CE), ChrW(0xE9D1), 10, 35, 180)
    _PasswordInput_GUICtrlsCreate($idInputC, $idEyeShwnC, $idEyeHddnC, $bHideC, ChrW(0xE919), ChrW(0xE91C), 10, 60, 180)
    GUICtrlSetColor($idEyeHddnC, 0x888888)
    Local $iDefaultPasswordChar = _SendMessage(GUICtrlGetHandle($idInputC), $EM_GETPASSWORDCHAR)
    Local $idAccelButtonEnter = GUICtrlCreateDummy()
    Local $aAccelKeys[1][2] = [["{ENTER}", $idAccelButtonEnter]]
    GUISetAccelerators($aAccelKeys, $hGui)
    GUISetState(@SW_SHOW)
    While True
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                GUISetAccelerators("", $hGui) ; unset all accelerators for the specified winhandle.
                GUIDelete($hGui)
;~              _WinAPI_RemoveFontMemResourceEx($g__hEyeSlashsFontHandle) ; To remove the fonts that were installed, however when the process goes away, the system will unload the fonts.
                Return ""

            Case $idAccelButtonEnter
                ;                   ..clean up and return some data ?
;~              Local $hCtrl = _WinAPI_GetFocus(), $sCtrl = ControlGetText($hCtrl, "", 0)
;~              GUISetAccelerators("", $hGui) ; unset all accelerators for the specified winhandle.
;~              GUIDelete($hGui)
;~              Return SetExtended($hCtrl, $sCtrl)

                ConsoleWrite('- >' & ControlGetText(_WinAPI_GetFocus(), "", 0) & '<' & @CRLF)
;~              Send("{TAB}") ; ..to jump to the next field of this example


            Case $idEyeShwnA ;, $idEyeHddnA
                _PasswordInput_Clicked($bHideA, $idEyeHddnA, $idInputA, $iDefaultPasswordChar)

            Case $idEyeShwnB ;, $idEyeHddnB
                _PasswordInput_Clicked($bHideB, $idEyeHddnB, $idInputB, $iDefaultPasswordChar)

            Case $idEyeShwnC ;, $idEyeHddnC
                _PasswordInput_Clicked($bHideC, $idEyeHddnC, $idInputC, $iDefaultPasswordChar)

        EndSwitch
    WEnd
EndFunc   ;==>Example

Func _PasswordInput_Clicked(ByRef $bHide, $idEyeHidden, $idInput, $iDefaultPasswordChar)
    $__PasswordInput_PressedEnter_hTimer = TimerInit() ; for _PasswordInput_OnEnter_Delayed()
    $bHide = Not $bHide
    GUICtrlSetState($idEyeHidden, $bHide ? $GUI_SHOW : $GUI_HIDE)
    GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, $bHide ? $iDefaultPasswordChar : 0, 0)
    _WinAPI_RedrawWindow(GUICtrlGetHandle($idInput))
EndFunc   ;==>_PasswordInput_Clicked

Func _PasswordInput_GUICtrlsCreate(ByRef $idInput, ByRef $idEyeShown, ByRef $idEyeHidden, ByRef $bHide, $sCharShown, $sCharHidden, $iLeft, $iTop, $iWidth, $iHeight = 19, $iLabelFontSize = 13)
    GUICtrlCreateLabel("", $iLeft, $iTop, $iWidth, $iHeight, $SS_BLACKFRAME) ; makes the border
    GUICtrlSetState(-1, $GUI_DISABLE) ; makes the above Label unclickable
    $idInput = GUICtrlCreateInput("", $iLeft + 3, $iTop + 1, $iWidth - $iHeight - 5, $iHeight - 2, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD), $WS_EX_TOOLWINDOW)
    GUICtrlSetBkColor(-1, _WinAPI_SwitchColor(_WinAPI_GetSysColor($COLOR_BTNFACE))) ; Match the GUI's color. This fake control has a "border" afterall.
    $idEyeShown = GUICtrlCreateLabel($sCharShown, $iLeft + $iWidth - $iHeight, $iTop + 1, $iHeight - 2, $iHeight - 2)
    GUICtrlSetFont(-1, $iLabelFontSize, $FW_NORMAL, $GUI_FONTNORMAL, $g__sEyeSlashsFontname)
    $idEyeHidden = GUICtrlCreateLabel($sCharHidden, $iLeft + $iWidth - $iHeight, $iTop + 1, $iHeight - 2, $iHeight - 2)
    GUICtrlSetFont(-1, $iLabelFontSize, $FW_NORMAL, $GUI_FONTNORMAL, $g__sEyeSlashsFontname)
    $bHide = True
EndFunc   ;==>_PasswordInput_GUICtrlsCreate

Func _LoadFont_EyeSlashs(ByRef $sFontname)
    Local $hFont = 0, $tFont, $bFont = _bEyeSlashsFontFile()
    If Not @error Then
        $sFontname = "EyeSlashs"
        $tFont = DllStructCreate('byte[' & BinaryLen($bFont) & ']')
        DllStructSetData($tFont, 1, $bFont)
        $bFont = "" ; $bFont is in $tFont ; it can be cleared
        $hFont = _WinAPI_AddFontMemResourceEx(DllStructGetPtr($tFont), DllStructGetSize($tFont))
        $tFont = "" ; the system has made its own copy of the memory ; it can be cleared
    EndIf
    Return SetError(@error, @extended, $hFont)
EndFunc   ;==>_LoadFont_EyeSlashs

;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2020-06-05
Func _bEyeSlashsFontFile()
    Local $Base64String ; https://www.autoitscript.com/forum/index.php?showtopic=211400&view=findpost&p=1529608
    $Base64String &= 'i7YAAAEAAAALAIAAAAMAME9TLzJQDxIGwgCIvAAYYABjbWFw/7e9VRAAAAEcADxkZ2FUc3AAHBAAPIAAHAgAZ2x5ZjOIDLQBAB6IAAAHAGhlwGFkJtgdjQA0AB4IADZoACAHwgPNBQAewAAeJGhtdHgWJgAQAB7kAAgwbG8AY2EICAYgAAAECRQADxptYXhwUAASAGkADzAADyAAbmFtZaOXdusFAA9QAGOecG9zdBMApwAACvABHwADAwDHAZAABQAAAiiZAswAEY8DBwHrsAAzAQkCaAcAAQC2AQsAQAAA6dEDwOD/wABAA4ABgRGIDm+ASgAAgTaBARyADYMDA0GCEhwABABIgAMOQAAIAAIABoAJIADpGekc6dH//aT//4Mf6ReAB86CBwAB/+MW7RbrFo46hB6KS4AO/wAPgQsFgEQAgEQCAAA3OYcCE6UJgEz/wAPWgAkgDwAfAC8AEjIXABYVFAcGIyInACY1NDc2EzI3ADY1NCcmIyIHQAYVFBcWE4APFwIGgw8nNjc2AgCUNCYAADRDAVg/AAACWEMBnoCAODiAZICexAECK0YJQAH+BqrGCUABAhZYWJBckFgAAEEBwSUEwiXUAcAlBgAYAC0AP0VAJjOAHh0BJYIhMwgyNyfFKAE3AQcWJkAjxiQ3QAMFIgcsJzZBDAArJ0IwAfoSBgEewhjAHC4wQgQQDEADBP7SNgIA9DYKNTUcVmQBASoWLy8sGCsrAAGkKCZcTlyegH9/ODBifBBAKCFBLwhmMC5AKxhCAgQAAwwQAS42/YAMNgo0NBwkAC4AND8/IhgsLG4IEFweQAN2VHwmXijACsEyQFvAMqrCWCEXQVhLVEZcIYRcMwEqIchUAeBYPgAAWP7KVMMBAcpRAVbJUd4ac0FvyxoC1spvqBrDjgQh4UkbAEkAYX0iBwAOAQcGBxYXHhIBQjQ+AYIxLgEnhiZBAoADDgEjIgICM0ADQAAOAaASiAU1NMQmJ8AB'
    $Base64String &= 'MQcUgDkAFAEgOBYCAFRNTYQANTUkJDU1hE0ETVSqAaguSx0dAEsuOIFDQ4E4AWMBAgYDBwgUFABGLi81NS8uRgAUFAgHAwYC/BA4KCg4YQADABcAGFQ7O0dHOzsIVBgXaQGqHE0tgC1NHCQmJiQjAcACBAIVLBeDCAMKqBcsFYACNiMJOGogIAsAWgBmYCAjNQAjFSMVMxUzNYwzB38eYR48ATFjJJ+AAAA1UCiAA6ACJTJgNxHkIgQAgAIAoA4ZAgv9HykjIzMPDhABECAQEikNIBIgFjEa/kCEGgNAIQILvg8hEpwhAQEACxcXQCgnLAICAk8qGjIXDREDrn6lLmZ6YiUDYFMt4CUAAAEhFSEXITV1+B4hiB4Bv0ehR6MuAgCAAYD+gOb+2kH1HhxOMP46hB4BToQ/SGMDwCNAfBEeOORhJ4Ud/qp/SKMDIdABZCIeACgAOQBHYWJIJiIPAWci4BkHAgYBHTMyNjcBNgA0ATIWFwcuAU0AIgXnIEICJyUgIAF3AQXjJ0AHFWlQ4AFIKwMAsg4oDsonUisBBCIfWDafDg4HABIJCRIHA2AOAP3gIDEKehwlCDj+9mUiGRY9KABCGgKSBgb+vogTJxRTDT5FAbQRSTAUHTmADWAyFAUihGM9QAYOygwMMxLQPmkonzAHBwAAAAYAKP7cJRx6CjEQICg4wJYSKUsfAD0bRilGFCcTEP6+BgYiE81FAQQBAcU5BwdNEBEx4wRDcSp0bTEAuPUACntfDzz1AAvjgCYAAOHcbLGEdABUFv8AhDFS9HMQARFx8wJQAB12/gyTAQMAYQPxAD8ANwACAAgKABTQHGoA0AEABgE8Ab4CVAKM3gNRj9EFDABnMR8j5AQNAA4ArjQIAQCrUYizAAIAknK0AANwAao8tAAEsACHtAAF8EcqG7QABnABV7QACgBIGgCisYMECRABEquQAbMAArAGebQAA3ABKkW0AASwAJC0AAUAqBYAJrQABnAB'
    $Base64String &= 'YLQAAAoANAC8RXllQFNsYXNoc6ADeQAAZQBTAGwAYQAAcwBoAHNWZQByc2lvbiAxLigwAFagAXJgAWkACG8AbpCRMQAuAB4wvwO2A68BpgFSZWdAdWxhcgBSYAFnNAB1ggFy/wL2AkZvAG50IGdlbmVyAGF0ZWQgYnkgAEljb01vb24uVABG0gh08AhnMANuRTIKYfAAZQBkMAFi1ZAEIBBtY1ACTTAAsQIOLtScDwAGAA=='
    $Base64String = _WinAPI_Base64Decode($Base64String)
    If @error Then Return SetError(1, 0, 0)
    Local $tDecompress, $tSource = DllStructCreate('byte[' & BinaryLen($Base64String) & ']')
    DllStructSetData($tSource, 1, $Base64String)
    _WinAPI_LZNTDecompress($tSource, $tDecompress, 2832)
    If @error Then Return SetError(3, 0, 0)
    $tSource = 0
    Return Binary(DllStructGetData($tDecompress, 1))
EndFunc   ;==>_bEyeSlashsFontFile

Func _WinAPI_Base64Decode($sB64String)
    Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "")
    Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]")
    $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($bBuffer, 1)
EndFunc   ;==>_WinAPI_Base64Decode

Func _WinAPI_LZNTDecompress(ByRef $tInput, ByRef $tOutput, $iBufferSize)
    $tOutput = DllStructCreate("byte[" & $iBufferSize & "]")
    If @error Then Return SetError(1, 0, 0)
    Local $aRet = DllCall("ntdll.dll", "uint", "RtlDecompressBuffer", "ushort", 0x0002, "struct*", $tOutput, "ulong", $iBufferSize, "struct*", $tInput, "ulong", DllStructGetSize($tInput), "ulong*", 0)
    If @error Then Return SetError(2, 0, 0)
    If $aRet[0] Then Return SetError(3, $aRet[0], 0)
    Return $aRet[6]
EndFunc   ;==>_WinAPI_LZNTDecompress

On my alternate windows theme(s) it looks like these:
         image.png.1232d76e54f4593db56827200ee926df.png            image.png.22d8cc157b2ecd81721bf55e9eea9294.png            image.png.de069df4748cf63323dfddeb1045db03.png

 

Edited by argumentum
OCD ?

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • 4 months later...

 

; https://www.autoitscript.com/forum/topic/211400-autoit-password-style/?do=findComment&comment=1529603

#include <GUIConstants.au3>
#include <WinAPIGdi.au3>

GUICreate("Login", 200, 100)

GUICtrlCreateLabel("", 10, 10, 180, 19, $SS_BLACKFRAME)
GUICtrlSetState(-1, $GUI_DISABLE)
Local $idInput = GUICtrlCreateInput("123456", 13, 11, 154, 17, $ES_PASSWORD, $WS_EX_TOOLWINDOW)
Local $idEye = GUICtrlCreateLabel("👁", 167, 11, 21, 17, $SS_CENTERIMAGE), $bHide = True
GUICtrlSetFont(-1, 14, 400, 0)
Local $idEyeSl = GUICtrlCreateLabel("/", 174, 8, 10, 21)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(-1, 16, 300)

Local $iDefault = GUICtrlSendMsg($idInput, $EM_GETPASSWORDCHAR, 0, 0)

GUISetState()

While True
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idEye
            $bHide = Not $bHide
            GUICtrlSetState($idEyeSl, $bHide ? $GUI_SHOW : $GUI_HIDE)
            GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, $bHide ? $iDefault : 0, 0)
            _WinAPI_RedrawWindow(GUICtrlGetHandle($idInput))
    EndSwitch
WEnd

 

I know that I know nothing

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