CUT_RAS::SetDialEntryParams
int SetDialEntryParams(LPCSTR szEntryName,LPRASDIALPARAMS pRasDialParams, BOOL bClearPassword = FALSE)
Parameters
szEntryName |
A phonebook entry name. |
pRasDialParams |
A pointer to a RASDIALPARAMS structure. |
bClearPassword |
Set this to TRUE to remove the password from the given entry. Set this to FALSE to set the password. |
Return Value
UTE_SUCCESS |
Operation completed successfully. |
UTE_ERROR |
Function failed (see GetLastRASError for more details). |
UTE_NULL_PARAM |
The pRasDialParams parameter is NULL. |
UTE_RAS_LOAD_ERROR |
Unable to load the RAS DLLs. |
Remarks
Call this function to set the dialing parameters for the given phonebook entry. The phonebook entry MUST exist for this function to succeed.
Use SetDialEntryParams to store the username and password for a phonebook entry. The RASDIALPARAMS structure also contains other optional information.
Refer to the MSDN library for more information on the RASDIALPARAMS structure.
Example
// set the dialing parameters for a dialup entry
if (m_pRas->SetEntryProperties(m_szEntryName,m_rasEntry)== UTE_SUCCESS)
{
// now set the Dialup properties
LPRASDIALPARAMS pDialParam = new RASDIALPARAMS[sizeof(RASDIALPARAMS)+1];
memset(pDialParam,0,sizeof(RASDIALPARAMS));
pDialParam->dwSize= sizeof(RASDIALPARAMS);
// Set the Entry name
strcpy(pDialParam->szEntryName ,m_szEntryName);
// set the phone number
GetDlgItemText(IDC_PHONE_NUMBER,pDialParam->szPhoneNumber,RAS_MaxPhoneNumber);
// set the user name
GetDlgItemText(IDC_USER,pDialParam->szUserName,UNLEN);
// set the password string
GetDlgItemText(IDC_PASSWORD,pDialParam->szPassword,PWLEN);
// now update the entry's Dialup parameters
m_pRas->SetDialEntryParams (m_szEntryName,pDialParam,FALSE);
delete [] pDialParam ;
}