Logon method
If each of pServerName, pUserId, and pPassword are non-NULL and point to a string other than an empty string, a logon is performed with the specified data.
- Method
- short Logon(
- Parameters
- pServerName
- Points to a null-terminated character string containing the name of the server.
- pUserID
- Points to a null-terminated character string containing the user ID.
- pPassword
- Points to a null-terminated character string containing the password.
- Description
-
If pServerName and pUserId point to meaningful pPassword strings and pPassword points to a single space character, the logon will proceed with no password for the user.
If any of pServerName, pUserId, and pPassword are NULL or point to an empty string, the normal Content Manager OnDemand Logon dialog box is displayed with the partial information provided. The user can then enter the missing information and complete the logon.
- Return Value
- Refer to return codes.
- See Also
- GetNumServers, GetServerNames, Logoff, and SetLogonReturnOnFailure methods
C/C + +
The following example retrieves the names of all servers available for logon, puts them in a ComboBox control, retrieves the chosen server, user ID, and password, and performs a logon. CArsOle * pArsCtrl;
ArsOleName * pServerNames;
CComboBox * pServersList;
CEdit * pUserId;
CEdit * pPassword;
char server[ sizeof( ArsOleName ) ];
char user[ sizeof( ArsOleName ) ];
char password[ sizeof( ArsOleName ) ];
short rc, j, num_servers;
int index;
VARIANT vari;
.
.
// During dialog initialization:
rc = pArsCtrl->GetNumServers( &vari );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
num_servers = var.iVal;
pServerNames = new ArsOleName[ max( num_servers, 1 ) ];
rc = pArsCtrl->GetServerNames( (IUnknown*)pServerNames, num_servers );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
for ( j = 0; j < num_servers; j++ )
index = pServersList->AddString( pServerNames[j] );
pServersList->SetCurSel( 0 );
.
.
// During OK button processing:
pServersList->GetWindowText( server, sizeof(server) );
pUserId->GetWindowText( user, sizeof(user) );
pPassword->GetWindowText( password, sizeof(password) );
rc = pArsCtrl->Logon( server, user, password );
if ( rc != ARS_OLE_RC_SUCCESS )
ERROR;
.
.
Visual Basic
Dim rc, count As Integer
Dim num_servers As Variant
Dim Temp As String
.
.
rc = ArsOle.GetNumServers (num_servers)
If rc <> ARS_OLE_RC_SUCCESS Then
MsgBox "ERROR"
End
End If
For count = 0 To num_servers -1
rc = ArsOle.GetServerName(count, Temp)
lbServers.AddItem Temp
Next count
.
.
' During OK button processing
rc = ArsOle.Logon (lbServers.List(lbServers.ListItem), txtUser.Value, txtPasswd.Value)
If rc <> ARS_OLE_RC_SUCCESS Then
MsgBox "ERROR"
End
End If