Compartir a través de


Changing an Existing Phone-Book Entry

The RasRenameEntry function renames a phone-book entry in the registry, while the RasDeleteEntry function deletes an entry. To verify if the string is in the correct format, the application can use the RasValidateEntryName function.

To change a registry phone-book entry

  1. Call RasValidateEntryName to verify the new name.

  2. Call the RasRenameEntry function to change the name.

    The return value is zero if successful, and a RAS error value is returned if it is not successful.

Changing a Phone-Book Entry Example

The following code example shows how to change an existing phone-book entry.

BOOL RenameRasEntry (LPTSTR lpszOldName, LPTSTR lpszNewName)

{
  DWORD dwError;            // Return code from functions 
  TCHAR szError[120];       // Buffer for error message 

  if (dwError = RasValidateEntryName (NULL, lpszNewName))
  {
    wsprintf (szError, TEXT("Entry name validation failed: %ld"), 
              dwError);
    return FALSE;
  }

  if (dwError = RasRenameEntry (NULL, lpszOldName, lpszNewName))
  {
    wsprintf (szError, TEXT("Unable to rename entry: %ld"), dwError);
    return FALSE;
  }

  return TRUE;
}

See Also

Phone-Book Operation

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.