CredUIPromptForCredentialsW (credui)
Last changed: -173.9.50.129

.
Summary
Open the standard Windows Password Prompt Dialg - only works on XP/W2K3

C# Signature:

  [DllImport("credui", EntryPoint="CredUIPromptForCredentialsW", CharSet = CharSet.Unicode)]
  private static extern CredUIReturnCodes CredUIPromptForCredentials(ref CREDUI_INFO creditUR,
            string targetName,
            IntPtr reserved1,
            int iError,
            StringBuilder userName,
            int maxUserName,
            StringBuilder password,
            int maxPassword,
            ref int iSave,
            CREDUI_FLAGS flags);

VB .NET Signature:

Declare Function CredUIPromptForCredentialsW Lib "credui.dll" (TODO) As TODO

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

  string host = "Database Client";
  CREDUI_INFO info = new CREDUI_INFO();
  info.pszCaptionText = host;  
  info.pszMessageText = "Please Enter Your Enterprise ID";

  CREDUI_FLAGS flags = CREDUI_FLAGS.GENERIC_CREDENTIALS |
        CREDUI_FLAGS.SHOW_SAVE_CHECK_BOX |
        CREDUI_FLAGS.ALWAYS_SHOW_UI |
        CREDUI_FLAGS.EXPECT_CONFIRMATION;

  bool savePwd = false;
  CredUIReturnCodes result = CredUI.PromptForCredentials(ref info, host, 0, ref username,
                ref password, ref savePwd, flags);

Alternative Managed API:

TODO

Documentation