CryptoSys PKI Toolkit Manual

PWD_PromptEx

And PWD_PromptEx prompt for a password in a dialog box.

VB6/VBA Syntax

Public Declare Function PWD_PromptEx Lib "diCrPKI.dll" (ByVal strPassword As String, ByVal nPwdLen As Long, ByVal strCaption As String, ByVal strPrompt As String, ByVal nOptions As Long) As Long

nRet = PWD_PromptEx(strPassword, nPwdLen, strCaption, strPrompt, nOptions)

Parameters

strPassword
[out] String to receive the password entered by the user.
nPwdLen
[in] Long specifying the maximum length of the string to be received.
strCaption
[in] String specifying a caption for the dialog box (optional).
strPrompt
[in] String specifying the prompt (default="Enter password:").
nOptions
[in] Long option flags: not used in this release. Specify zero.

C/C++ Syntax

long _stdcall PWD_PromptEx(char *szPassword, long nPwdLen, const char *szCaption, const char *szPrompt, long flags);

Returns (VB6/C)

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.

.NET Equivalent

Pwd.Prompt Method (Int32, String, String)

Remarks

See PWD_Prompt.

Example

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 = ""

See Also

PWD_Prompt

[Contents] [Index]

[HOME]   [NEXT: RNG_Bytes...]

Copyright © 2004-12 D.I. Management Services Pty Ltd. All rights reserved.