Secure edit
Homepage: Secure Edit Control
SecureEditHwnd := DllCall("AHKCtrlSupport\CreateSecureEditID", DWORD, dwexStyle, DWORD, Edit3HWnd, "Cdecl Int")
| SecureEditHwnd |
Handle to the new control |
| Style |
See AHK documentation for edit control styles (WS_VISIBLE is important if you want to see the control :-) ) |
| Edit3HWnd |
Handle to an existing edit control. This one gets replaced by the secured edit control |
nRC := DllCall("AHKCtrlSupport\SetSecureEditText", DWORD, SecureEditHwnd, str, "Password", "Cdecl Int")
| fRC |
Error: 0 ok: 1 |
| SecureEditHwnd |
Handle to the secure edit control. |
| "Password" |
Sets this new text as password |
fRC := DllCall("AHKCtrlSupport\GetSecureEditText", DWORD, SecureEditHwnd, str, EnteredData, int, 20, "Cdecl Int")
| fRC |
Error: 0 ok: 1 |
| SecureEditHwnd |
Handle to the secure edit control. |
| EnteredData |
The password the user has entered |
| int xx |
Length of the string. Use VarSetCapacity(EnteredData,20) to retrieve a password which is max 20 characters long |
Example:
; --------------- Create a Secured Edit ----------------------------------
; -----------------------------------------------------------------------
dwexStyle := 0x10000000
SecureEditHwnd := DllCall("AHKCtrlSupport\CreateSecureEditID", DWORD, dwexStyle, DWORD, Edit3HWnd, "Cdecl Int")
if (errorlevel <> 0) || (MaskEditHwnd = 0)
{
MsgBox error while calling CreateSecureEditID Errorlevel: %errorlevel% - RC: %TransBtnHwnd%
return
}
nRC := DllCall("AHKCtrlSupport\SetSecureEditText", DWORD, SecureEditHwnd, str, "Password", "Cdecl Int")
if (errorlevel <> 0) || (nRC = 0)
{
MsgBox error while calling SetSecureEditText Errorlevel: %errorlevel% - RC: %TransBtnHwnd%
return
}
;define a button with the glabel : RetrieveSecText
RetrieveSecText:
{
VarSetCapacity(EnteredData, 20)
fRC := DllCall("AHKCtrlSupport\GetSecureEditText", DWORD, SecureEditHwnd, str, EnteredData, int, 20, "Cdecl Int")
if (errorlevel <> 0) || (fRC = 0)
{
MsgBox error while calling GetSecureEditText Errorlevel: %errorlevel% - RC: %TransBtnHwnd%
return
}
MsgBox You have entered the text:%EnteredData%
}
return