NassauSky 10 Posted April 16 Share Posted April 16 (edited) I am so close to getting a password show/reveal button working but not quite there. This sample works on the second mouse down event. I can't figure out what's going on yet. #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") $hGUI = GUICreate("Test", 500, 200) $cInput = GUICtrlCreateInput("", 10, 10, 200, 20, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) $cCheck = GUICtrlCreateButton("Show Password", 10, 50, 150, 20) GUISetState() $sDefaultPassChar = GUICtrlSendMsg($cInput, $EM_GETPASSWORDCHAR, 0, 0);Retrieve the ASCII value of the default password char While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cCheck While 1 ConsoleWrite("_IsPressed - Left Mouse was pressed." & @CRLF) GUICtrlSendMsg($cInput, $EM_SETPASSWORDCHAR, $sDefaultPassChar, 0) GUICtrlSetState($cInput, $GUI_FOCUS) While _IsPressed("01", $hDLL) ; Wait until mouse is released. Sleep(20) WEnd ConsoleWrite("_IsPressed - Left Mouse was released." & @CRLF) GUICtrlSendMsg($cInput, $EM_SETPASSWORDCHAR, 0, 0) GUICtrlSetState($cInput, $GUI_FOCUS) ExitLoop Sleep(20) WEnd EndSwitch WEnd DllClose($hDLL) Thanks for any help. Edited April 16 by NassauSky Link to post Share on other sites
NassauSky 10 Posted April 17 Author Share Posted April 17 (edited) OK for anyone else interested. Thanks from the pieced together code help from @Yashied & @Melba23 expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <EditConstants.au3> #include <Misc.au3> Global $Over = False, $OldOver = False Local $hDLL = DllOpen("user32.dll") $Form1 = GUICreate('Form1', 230, 297, 303, 543) $Button1 = GUICtrlCreateButton('Reveal Password', 80, 100, 75, 25) $cInput = GUICtrlCreateInput("", 10, 10, 200, 20, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) GUISetState(@SW_SHOW) $sDefaultPassChar = GUICtrlSendMsg($cInput, $EM_GETPASSWORDCHAR, 0, 0) $hWnd = ControlGetHandle(WinGetHandle('Form1'), '', '[CLASS:Button; INSTANCE:1]') While 1 $tPoint = _WinAPI_GetMousePos() If _IsPressed("01", $hDLL) Then If Not $Over And _WinAPI_WindowFromPoint($tPoint) = $hWnd Then ConsoleWrite('Over' & @CR) $Over = 1 GUICtrlSendMsg($cInput, $EM_SETPASSWORDCHAR, 0, 0) GUICtrlSetState($cInput, $GUI_FOCUS) ControlClick ( $Form1, "", $cInput, "left" ) EndIf Else If $Over Then ConsoleWrite('Lost' & @CR) $Over = 0 GUICtrlSendMsg($cInput, $EM_SETPASSWORDCHAR, $sDefaultPassChar, 0) GUICtrlSetState($cInput, $GUI_FOCUS) ControlClick ( $Form1, "", $cInput, "left" ) EndIf EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE DllClose($hDLL) Exit EndSwitch WEnd Edited April 17 by NassauSky Link to post Share on other sites
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now