Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than credui, prefix the name with the module name and a period.
CredUIPromptForCredentials (credui)
.
C# Signature:
[DllImport("credui")]
private static extern CredUIReturnCodes CredUIPromptForCredentials(ref CREDUI_INFO creditUR,
string targetName,
IntPtr reserved1,
int iError,
StringBuilder userName,
int maxUserName,
StringBuilder password,
int maxPassword,
[MarshalAs(UnmanagedType.Bool)] ref bool pfSave,
CREDUI_FLAGS flags);
VB Signature:
''' <summary>
''' The CredUIPromptForCredentials function creates and displays a configurable dialog box that accepts credentials information from a user.
''' Applications that target Windows Vista or Windows Server 2008 should call CredUIPromptForWindowsCredentials instead of this function.
''' See http://msdn.microsoft.com/en-us/library/aa375177(v=VS.85).aspx
''' </summary>
''' <param name="pUiInfo">The CREDUI_INFO structure with customises the appearance of the dialog.</param>
''' <param name="pszTargetName">The target for the credentials, typically a server name.</param>
''' <param name="Reserved">RESERVER - must be NULL.</param>
''' <param name="dwAuthError">If prompting after an error, pass the Windows Error code so the appropriate error message is included in the dialog.</param>
''' <param name="pszUserName">User Name variable which will populated from the buffer.</param>
''' <param name="ulUserNameMaxChars">The maximum length of the User Name variable.</param>
''' <param name="pszPassword">Password variable which will populated from the buffer.</param>
''' <param name="ulPasswordMaxChars">The maximum length of the Password variable.</param>
''' <param name="pfSave">If set to <c>True</c> the check the "Save" checkbox on the dialog - only displayed if appropriate dwFlags passed (see remarks below).</param>
''' <param name="dwFlags">Flags to control the dialog functionality (see <see cref="CredUIWinFlags" />.</param>
''' <remarks>
''' If the CREDUI_FLAGS_PERSIST flag is specified, the Save check box is not displayed, but is considered to be selected.
''' If the CREDUI_FLAGS_DO_NOT_PERSIST flag is specified and CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX is not specified, the Save check box is not displayed,
''' but is considered to be cleared. An application that needs to use CredUI to prompt the user for credentials, but does not need the credential
''' management services provided by the credential manager, can use pfSave to receive the state of the Save check box after the user closes the
''' dialog box. To do this, the caller must specify CREDUI_FLAGS_DO_NOT_PERSIST and CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX in dwFlags. When
''' CREDUI_FLAGS_DO_NOT_PERSIST and CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX are set, the application is responsible for examining *pfSave after the
''' function returns, and if *pfSave is TRUE, then the application must take the appropriate action to save the user credentials within the
''' resources of the application.
''' </remarks>
''' <returns>Zero on success, otherwise a non-zero error code.</returns>
<DllImport("CREDUI.dll", CharSet:=CharSet.Unicode)> <CLSCompliant(False)> _
Public Shared Function CredUIPromptForCredentials(ByRef pUiInfo As CREDUI_INFO, _
ByVal pszTargetName As String, _
ByVal Reserved As IntPtr, _
ByVal dwAuthError As UInt32, _
ByVal pszUserName As StringBuilder, _
ByVal ulUserNameMaxChars As UInt32, _
ByVal pszPassword As StringBuilder, _
ByVal ulPasswordMaxChars As UInt32, _
<MarshalAs(UnmanagedType.Bool)> ByRef pfSave As Boolean, _
ByVal dwFlags As CREDUI_FLAGS) As CredUIReturnCodes
End Function
Open the standard Windows Password Prompt Dialog - only works on XP/W2K3
10/2/2022 1:01:29 AM - -171.251.236.129
The CredUIPromptForWindowsCredentials function creates and displays a configurable dialog box that allows users to supply credential information by using any credential provider installed on the local computer.
12/2/2015 8:38:46 AM - -82.113.106.205
The CredUnPackAuthenticationBuffer function converts an authentication buffer returned by a call to the CredUIPromptForWindowsCredentials function into a string user name and password.
3/26/2011 3:58:08 AM - ABWho-60.242.128.122
The CredUIPromptForWindowsCredentials function creates and displays a configurable dialog box that allows users to supply credential information by using any credential provider installed on the local computer.
12/2/2015 8:38:46 AM - -82.113.106.205
The CredUnPackAuthenticationBuffer function converts an authentication buffer returned by a call to the CredUIPromptForWindowsCredentials function into a string user name and password.
3/26/2011 3:58:08 AM - ABWho-60.242.128.122
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).