Added IncorrectPassword for windows versions newer as Windows XP

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@883 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2010-09-21 15:28:21 +00:00
commit e820e1bc0e

View file

@ -29,6 +29,7 @@ using System.Windows.Forms;
/// <summary>
/// The following code comes from: http://www.developerfusion.com/code/4693/using-the-credential-management-api/
/// and is slightly modified so it works for us.
/// Oh, try Start-> Run and type "Control keymgr.dll" to see your usernames and passwords
/// The following code is an example for a login, it will call the Authenticate with user/password
/// which should return true if the login worked, false if not.
/// private static bool Login(string system, string name) {
@ -45,6 +46,7 @@ using System.Windows.Forms;
/// } catch (ApplicationException) {
/// // exception handling ...
/// }
/// dialog.IncorrectPassword = true;
/// }
/// }
/// } catch (ApplicationException) {
@ -132,6 +134,17 @@ namespace Greenshot.Helpers {
}
}
private bool _incorrectPassword = false;
/// <summary>Gets or sets if the incorrect password balloontip needs to be shown. Introduced AFTER Windows XP</summary>Gets></summary>
public bool IncorrectPassword {
get {
return _incorrectPassword;
}
set {
_incorrectPassword = value;
}
}
private bool _keepName = false;
/// <summary>Gets or sets if the name is read-only.</summary>
public bool KeepName {
@ -440,6 +453,10 @@ namespace Greenshot.Helpers {
private CREDUI.FLAGS GetFlags() {
CREDUI.FLAGS flags = CREDUI.FLAGS.GENERIC_CREDENTIALS;
if (this.IncorrectPassword) {
flags = flags | CREDUI.FLAGS.INCORRECT_PASSWORD;
}
if (this.AlwaysDisplay) {
flags = flags | CREDUI.FLAGS.ALWAYS_SHOW_UI;
}