private static extern CredUiReturnCodes CredUIPromptForCredentials( ref CredUiInfo credUiInfo, string targetName, IntPtr reserved1, int iError, StringBuilder userName, int maxUserName, StringBuilder password, int maxPassword, ref int iSave, CredFlags credFlags );
/// <summary>Returns the info structure for dialog display settings.</summary> /// <param name="owner">The System.Windows.Forms.IWin32Window the dialog will display in front of.</param> private CredUiInfo GetInfo(IWin32Window owner) { var info = new CredUiInfo(); if (owner != null) { info.hwndParent = owner.Handle; } info.pszCaptionText = Caption; info.pszMessageText = Message; if (Banner != null) { info.hbmBanner = new Bitmap(Banner, ValidBannerWidth, ValidBannerHeight).GetHbitmap(); } info.cbSize = Marshal.SizeOf(info); return(info); }