The RasDial function establishes a RAS connection between a RAS client and a RAS server.

RasDialEx(cPhonebookEntry | nRasDialParamsPtr [, cPhonebook [, cCallback [, nFlags [, nRasConn]]]])

Parameters

cPhonebookEntry | nRasDialParamsPtr

Either the name of the phonebookentry or a pointer to a RASDIALPARAMS structure.

cPhonebook (optional)

default = empty

If cPhonebook is empty the system default phonebook is used otherwise the it should specify a valid phonebook filename.
The default phone-book file is the one selected by the user in the User Preferences property sheet of the Dial-Up Networking dialog box.

cCallback (optional)

default = no callbacks are made during the dial operation.

A FoxPro function to call back.

If you pass a callback function the RasDial function is executed asyncronously.
It will return immediately and during the dial process your callback function will be called and
provide you with the current status of the operation.

See class RasConnection:DialCallback in the ras.prg example.

nFlags (optional)

default = 0

One or a combination of the following flags.
ConstantDescription
RDEOPT_UsePrefixSuffixIf this flag is set, RasDialEx uses the prefix and suffix that is in the RAS phone book.
If this flag is not set, RasDialEx ignores the prefix and suffix that is in the RAS phone book.
If no phone book entry name is specified in the call to RasDialEx, the actual value of this flag is ignored, and it is assumed to be zero.
RDEOPT_PausedStatesIf this flag is set, RasDialEx accepts paused states. Examples of paused states are terminal mode, retry logon, change password, set callback number, and EAP authentication.
If this flag is not set, RasDialEx reports a fatal error if it enters a paused state.
RDEOPT_IgnoreModemSpeakerIf this flag is set, RasDialEx ignores the modem speaker setting that is in the RAS phone book, and uses the setting specified by the RDEOPT_SetModemSpeaker bit flag.
If this flag is not set, RasDialEx uses the modem speaker setting that is in the RAS phone book, and ignores the setting specified by the RDEOPT_SetModemSpeaker bit flag.
If no phone book entry name is specified in the call to RasDialEx, the choice is between using a default setting or the setting specified by the RDEOPT_SetModemSpeaker bit flag. The default setting is used if RDEOPT_IgnoreModemSpeaker is zero. The setting specified by RDEOPT_SetModemSpeaker is used if RDEOPT_IgnoreModemSpeaker is one.
RDEOPT_SetModemSpeakerIf this flag is set, and RDEOPT_IgnoreModemSpeaker is one, RasDialEx sets the modem speaker on.
If this flag is not set, and RDEOPT_IgnoreModemSpeaker is one, RasDialEx sets the modem speaker off.
If RDEOPT_IgnoreModemSpeaker is not set, RasDialEx ignores the value of RDEOPT_SetModemSpeaker, and sets the modem speaker based on the RAS phone-book setting or the default setting.
RDEOPT_IgnoreSoftwareCompressionIf this flag is set, RasDialEx ignores the software compression setting that is in the RAS phone book, and uses the setting specified by the RDEOPT_SetSoftwareCompression bit flag.
If this flag is not set, RasDialEx uses the software compression setting that is in the RAS phone book, and ignores the setting specified by the RDEOPT_SetSoftwareCompression flag.

If no phone-book entry name is specified in the call to RasDialEx, the choice is between using a default setting or the setting specified by the RDEOPT_SetSoftwareCompression bit flag. The default setting is used if RDEOPT_IgnoreSoftwareCompression is zero. The setting specified by RDEOPT_SetSoftwareCompression is used if RDEOPT_IgnoreSoftwareCompression is one.
RDEOPT_SetSoftwareCompressionIf this flag is set, and RDEOPT_IgnoreSoftwareCompression is one, RasDialEx uses software compression.
If this flag is not set, and RDEOPT_IgnoreSoftwareCompression is one, RasDialEx does not use software compression.

If RDEOPT_IgnoreSoftwareCompression is zero, RasDialEx ignores the value of RDEOPT_SetSoftwareCompression, and sets the software compression state based on the RAS phone-book setting or the default setting.
RDEOPT_UseCustomScriptingIf this flag is set, RasDialEx invokes a custom-scripting DLL after establishing the connection to the server.
RasDialEx only invokes the DLL if all of the following conditions are met:

This flag is set
A custom-scripting DLL is correctly registered with the system.
The RASEO_CustomScript option is specified in the phone-book entry.
RDEOPT_CustomDialIf this flag is set, RasDialEx dials normally instead of calling the RasCustomDial entrypoint of the custom dialer. This flag is used when RasCustomDialDlg calls RasDialEx so that RasDialEx does not have to call the custom dialer back.
RDEOPT_NoUserWindows Vista or later: If this flag is set, the connection was dialed from a Windows Logon context. In this case, RasDialEx uses default user preferences for the connection. This flag must be set if RCD_Logon is set in the dwfOptions parameter of RasCustomDialDlg.
nRasConn (optional)

default = not used

Pass an existing HRASCONN handle when you resume an asyncronously RasDialEx call from a paused state.

Return Value

A handle (HRASCONN) representing the RAS connection.

Example

Dialing a custom number.

Copy code
LOCAL lnConn, loRasParams
loRasParams = CREATEOBJECT('RASDIALPARAMS')
loRasParams.szPhoneNumber = '111 2453'
loRasParams.szCallbackNumber = '*'
loRasParams.szUserName = 'username'
loRasParams.szPassword = '******'
loRasParams.szDomain = ''
lnConn = RasDialEx(loRasParams.Address)

See Also

Reference

AbortRasConnectionNotification
ARasConnections
ARasDevices
ARasPhonebookEntries
RasClearConnectionStatistics
RasConnectionNotificationEx
RasDialDlgEx
RasGetConnectStatusEx
RasHangUpEx
RasPhonebookDlgEx

Used WinApi functions

RasDial
RasGetEntryDialParams
RasGetEapUserIdentity
RasGetConnectStatus
RasHangUp
RasFreeEapUserIdentity