PlatformVB

RasCreatePhonebookEntry

The RasCreatePhonebookEntry function displays the RAS dialog for creating a new entry:

 

Declare Function RasCreatePhonebookEntry _
      Lib "rasapi32.dll" Alias "RasCreatePhonebookEntryA" _
        (ByVal hwnd As Long, _
        ByVal lpszPhonebook As String) As Long

If the function succeeds the return value is 0, else if it fails it will return a value of 621.  

The hwnd parameter can be used to specify the hwnd of form to which the dialog will display modally.  You can  use 0& if you don't wish to specify a form's hwnd.

The lpszPhonebook parameter is the full path and name of a phonebook for windows NT or 2000.  On windows 95/98 this parameter is ignored and should be vbNullString.

 

Note: If the user cancels the operation by pressing the cancel button on the dialog, the function still returns 0.  If you need to know if the user cancelled the operation, you could call RasEnumEntries to get a count of entries immediately prior to, and after, your call to the RasCreatePhonebookEntry function.  If you are only designing for Windows NT4 or later the you can use the RasEntryDlg function instead.  The RasEntryDlg uses a RASENTRYDLG structure which enables you to tell if the user cancelled the operation. (see Platform SDK for more details)

 

See Also: Contents, Introduction, RasEnumEntries, RasGetEntryProperties, RasSetEntryProperties, RasErrorHandler.