|
The Remote Access Services (RAS) control enables an application
to connect to an Internet Service Provider (ISP) using a standard
Dial-Up Networking connection. Using this control, the application
can discover what dial-up devices are available, what dial-up
networking entries, known as "connectoids", are available on the
local system and allows the program to manage those connections.
Existing connections can be monitored, new connections created and
a single control can be used to manage multiple dial-up connections
if the system has more than one modem. While Windows can be
configured to simply autodial a service provider whenever a network
connection is needed, this component gives your application
complete control over the process of connecting to a service
provider, monitoring that connection and then terminating that
connection if needed.
The following properties, methods and events are available for
use by your application:
Initialize
Initialize the control and load the Remote Access Services
libraries for the current process. This method is normally not used
if the control is placed on a form in languages such as Visual
Basic. However, if the control is being created dynamically using a
function similar to CreateObject, then the application must call
this method to initialize the component before setting any
properties or calling any other methods in the control.
Connect
Establish a connection to the dial-up networking server. Once the
connection has been established, the control will authenticate the
session and the local system will have a network connection to the
service provider.
Disconnect
Disconnect from the server and release any resources that have been
allocated for the dial-up networking session. After this method is
called, the session is no longer valid.
Uninitialize
Unload the Remote Access Services libraries and release any
resources that have been allocated for the current process. This is
the last method call that the application should make prior to
terminating. This is only necessary if the application has
previously called the Initialize method.
Connection Properties The properties of the control
are used to set or return information about the current dial-up
networking connection. To load a dial-up networking connection,
called a connectoid or phonebook entry, use the LoadEntry method.
There are a large number of properties, however the most
significant of those properties are as follows:
DeviceName
This property specifies the name of the device that is used to
establish the dial-up networking connection. In most cases this is
the name of an analog modem using a serial communications port,
connected to a standard telephone line. If your application needs
to enumerate the available dial-up networking devices, refer to the
DeviceCount, DeviceEntry and DeviceType properties.
DynamicAddress
This property determines if the dial-up networking connection uses
a dynamically assigned IP address returned by the server, or a
specific IP address configured on the local host. In most cases,
this property should be set to True, unless otherwise specified by
your service provider.
DynamicNameserver
This property determines if the dial-up networking connection uses
dynamically assigned nameservers, used to resolve domain names into
IP addresses. In most cases, this property should be set to True.
If your service provider requires that you explicitly specify the
nameservers to use, then set this property to False and set the
NameServer property array to the address of the nameserver(s) to
use.
InternetAddress
This property returns the IP address assigned to the current
dial-up networking session, if a connection has been established.
It can also be used to explicitly specify an IP address if the
DynamicAddress property is set to False.
NameServer
This is a property array which specifies the IP addresses of the
nameservers that are to be used for the current dial-up networking
session. If a connection has been established, this property array
will return the addresses of those nameservers that have been
assigned to you. If the DynamicNameserver property is set to False,
this property array can also be used to explicitly specify the
nameservers to be used by the dial-up networking connection.
Password
This property specifies the password used to authenticate the
dial-up networking connection.
PhoneEntry
This property specifies the name of the connectoid for the current
dial-up networking connection. If no connection is active and no
connectoid has been loaded, then this property will return an empty
string.
PhoneNumber
This property specifies the telephone number for the dial-up
networking connection. You should also check the value of the
CountryCode property, which will tell your application if area code
dialing rules are being used. If the CountryCode property is set to
zero, then no area code dialing rules are in effect and the
telephone number is dialed as-is. Otherwise you should check the
value of the AreaCode property if you need to determine the area
code being used for the connection.
UserName
This property specifies the username used to authenticate the
dial-up networking connection.
Managing Connectoids
A connectoid contains the information needed to establish a
connection, and is represented as the icon in the Network
Connections for the local system. Connectoids are referenced by
name and typically are named after the service provider, such as
"EarthLink" or "Verizon". In addition to simply connecting to a
dial-up networking server, the control also enables your
application to create, edit and delete these connectoids. Note that
in the control documentation, connectoids are also referred to as
"entry names" or "phonebook entries". On Windows 95/98 and Windows
Me, the connectoid information is stored in the registry, however
under Windows NT and later versions, the connectoids are actually
stored as entries in a database files called "phonebooks". This
difference is automatically managed by the control depending on the
operating system its currently running under, but be aware that if
you explicitly specify an alternate phonebook database, it will
only work under Windows NT and later versions. In most cases, we
recommend that you simply use the default phonebook, which will
guarantee that your program runs under all Windows platforms
without having to write any platform-specific code.
CreateEntry
This method displays a dialog box that allows the user to specify
the information needed to create a new connectoid. This is similar
to the dialog that is displayed whenever the user chooses to create
a new Dial-Up Networking connection. Note that if you want to
create a connectoid without showing a dialog to the user, use the
SaveEntry method instead.
DeleteEntry
This method deletes an existing dial-up networking connection.
Exercise caution when using this method; once a connectoid has been
deleted, there is no way to recover it.
LoadEntry
This method loads an existing connectoid, and updates the control's
properties to reflect the connectoid's settings. Changing one or
more of those properties and then calling the SaveEntry method is
how you can modify an existing connectoid.
RenameEntry
This method renames an existing connectoid.
SaveEntry
This method modifies or creates a new connectoid based on the
current properties of the control. If the connectoid already
exists, it is modified, otherwise a new connectoid is created.
Unlike the CreateEntry method, this method will not display any
dialogs, so it is the responsibility of the application to provide
a user interface if needed.
|