This document is archived and information here might be outdated. Recommended version. |
Provides access to members that work with a dialog for getting user and password information.
Name | Description | |
---|---|---|
DoModal | Shows the dialog. | |
Password | The password entered in the dialog. | |
UserName | The user name entered in the dialog. |
CoClasses and Classes | Description |
---|---|
GetUserAndPasswordDialog | A dialog used for getting user and password information. |
The get user and password dialog is a dialog used for getting username and password information.
To get access to the IGetUserAndPasswordDialog interface, create a new GetUserAndPasswordDialog object.
The following code shows a GetUserAndPassword dialog and validates the username and password that was entered in the dialog. You would get m_app from the hook in ICommand::OnCreate().
IGetUserAndPasswordDialog pDlg=new GetUserAndPasswordDialogClass();
bool bOK=pDlg.DoModal("Login", "Login for this document:", m_app.hWnd);
if (bOK)
{
if (pDlg.UserName == "GISTeam" && pDlg.Password == "guru")
System.Windows.Forms.MessageBox.Show("You're in!");
else
System.Windows.Forms.MessageBox.Show("Wrong user name or password");
}
else
System.Windows.Forms.MessageBox.Show("Cancelled");
Dim pDlg As IGetUserAndPasswordDialog=New GetUserAndPasswordDialogClass()
Dim bOK As Boolean=pDlg.DoModal("Login", "Login for this document:", m_app.hWnd)
If bOK Then
If pDlg.UserName="GISTeam" AndAlso pDlg.Password="guru" Then
System.Windows.Forms.MessageBox.Show("You're in!")
Else
System.Windows.Forms.MessageBox.Show("Wrong user name or password")
End If
Else
System.Windows.Forms.MessageBox.Show("Cancelled")
End If