Nice UDF!
Here another variant:
;coded by UEZ 2011
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
Global Const $hGUI = GUICreate("Password", 339, 46)
Global Const $idInputPWD = GUICtrlCreateInput("", 128, 12, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD))
GUICtrlSetBkColor(-1, 0xFF0000)
Global Const $idLabelPWD = GUICtrlCreateLabel("Enter the passord:", 8, 14, 114, 19)
GUICtrlSetTip(-1, "Must be set to proceed! Minimum password length are 8 characters!")
GUICtrlSetFont(-1, 8, 400, 0, "Arial Black")
Global Const $idButtonGO = GUICtrlCreateButton("GO", 256, 10, 75, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
Global $nMsg, $mcursor_old
Global $aPassword, $m = False
Global $DefaultPassChar = GUICtrlSendMsg($idInputPWD, $EM_GETPASSWORDCHAR, 0, 0)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $idButtonGO
Exit
EndSwitch
$aPassword = GUIGetCursorInfo()
If Not @error Then
$mcursor_old = MouseGetCursor()
If $aPassword[4] = $idInputPWD Then
GUICtrlSendMsg($idInputPWD, $EM_SETPASSWORDCHAR, 0, 0)
GUISetCursor(16, 1, $hGUI)
$m = True
InputChk()
Else
If $m Then
GUICtrlSendMsg($idInputPWD, $EM_SETPASSWORDCHAR, $DefaultPassChar, 0)
ControlFocus("", "", $hGUI)
$m = False
GUISetCursor($mcursor_old)
EndIf
InputChk()
EndIf
EndIf
WEnd
Func InputChk() ;avoid flickering of controls
If Stringlen(GUICtrlRead($idInputPWD)) > 7 Then
If BitAND(GUICtrlGetState($idButtonGO), $GUI_DISABLE) = $GUI_DISABLE Then
GUICtrlSetState($idButtonGO, $GUI_ENABLE)
GUICtrlSetBkColor($idInputPWD, 0xFFFFFF)
EndIf
Else
If BitAND(GUICtrlGetState($idButtonGO), $GUI_ENABLE) = $GUI_ENABLE Then
GUICtrlSetState($idButtonGO, $GUI_DISABLE)
GUICtrlSetBkColor($idInputPWD, 0xFF0000)
EndIf
EndIf
EndFunc
When mouse is hovering input box password will be visible otherwise not.
Br,
UEZ