And PWD_PromptEx prompt for a password in a dialog box.
nRet = PWD_PromptEx(strPassword, nPwdLen, strCaption, strPrompt, nOptions)
String to receive the password entered by the user.Long specifying the maximum length of the string to be received.String specifying a caption for the dialog box (optional).String specifying the prompt (default="Enter password:").Long option flags: not used in this release. Specify zero.
long _stdcall PWD_PromptEx(char *szPassword, long nPwdLen, const char *szCaption, const char *szPrompt, long flags);
Long: If the user enters a password in the dialog box and clicks "OK",
the return value is the length of the password entered in bytes. This could be zero.
If the user clicks "Cancel", the return value is -1.
Pwd.Prompt Method (Int32, String, String)
See PWD_Prompt.
Example of PWD_PromptEx:
Dim strPassword As String * 511
Dim nLen As Long
nLen = PWD_PromptEx(strPassword, Len(strPassword), _
"Demo of PWD_PromptEx", "Type secret phrase:", 0)
' Do something with the password...
If nLen > 0 Then
Debug.Print "Password entered=" & Left(strPassword, nLen)
ElseIf nLen < 0 Then
Debug.Print "User cancelled"
Else
Debug.Print "Empty password entered"
End If
' Clean up
Call WIPE_String(strPassword, nLen)
strPassword = ""