@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: Open the standard Windows Password Prompt Dialg - only works on XP/W2K3 !!!!C# Signature: [DllImport("credui", CharSet = CharSet.Unicode)] private static extern CredUIReturnCodes CredUIPromptForCredentialsW(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 .NET Signature: Declare Function CredUIPromptForCredentialsW Lib "credui.dll" (byref creditUR AS CREDUI_INFO, _ byval targetName as string, _ byval reserved1 as IntPtr, _ byval iError as int32, _ byref UserName as StringBuilder, _ byval maxUserName AS int32, _ byref password AS StringBuilder, _ byval maxPassword as inte32, _ <MarshalAs(UnmanagedType.Bool)> byref pfSave AS Boolean, _ flags AS CREDUI_FLAGS) As CredUIReturnCodes !!!!User-Defined Types: [CREDUI_FLAGS], [CREDUI_INFO], CredUIReturnCodes !!!!Notes: None. !!!!Tips & Tricks: !!!!Sample Code: const int MAX_USER_NAME = 100; const int MAX_PASSWORD = 100; const int MAX_DOMAIN = 100; public static CredUIReturnCodes PromptForCredentials( ref CREDUI_INFO creditUI, string targetName, int netError, ref string userName, ref string password, ref bool save, CREDUI_FLAGS flags) { StringBuilder user = new StringBuilder(MAX_USER_NAME); StringBuilder pwd = new StringBuilder(MAX_PASSWORD); creditUI.cbSize = Marshal.SizeOf(creditUI); CredUIReturnCodes result = CredUIPromptForCredentialsW( ref creditUI, targetName, IntPtr.Zero, netError, user, MAX_USER_NAME, pwd, MAX_PASSWORD, ref save, flags); userName = user.ToString(); password = pwd.ToString(); return result; } 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 = PromptForCredentials(ref info, host, 0, ref username, ref password, ref savePwd, flags); !!!!Alternative Managed API: TODO Documentation: CredUIPromptForCredentialsW@msdn on MSDN
Edit credui.CredUIProm...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.