Giandomenico's page
home
VBRasEng OLE server

by Giandomenico De Sanctis - gidesay@yahoo.com
version 1.0 - 1998

The VBRasEng OLE server permits to Visual Basic programs to interface with the Remote Access Services library, present in Windows 95/98 and NT. The server is 32-bit, compiled with VB 5; then it will be used from VB5 and VB 4-32 bit programs.
The Remote Access Services library (RASAPI32.DLL) control the data connections opened through a communication device, typically a modem, or an ISDN adapter.
Among the functions in the library, there are phonebook entries managing (create, update, delete), and active connections managing (enumerate, querying status, ecc.).
The OLE server attempt to render more VB-developer-friendly the functions exported by RASAPI32. It is based on a Microsoft example. To install, download the VBRASENG.ZIP, unpack it, and copy in the \WINDOWS\SYSTEM directory; then, register the server typing in the Start menu/Execute window the command:
REGSVR32.EXE VBRASENG.DLL

For use in a VB program, open the program project, then open the references window, select the RAS Engine, and click OK.
In the subsequent tables are listed the properties and methods exposed by the server.

Property/method Parameters list Property type/ method return value Description
       
RASEngine     the main object of the class; at the initialization, load the RASAPI32.dll, and store all the RAS entries and all the active connections in a couple of internal collections
Properties      
OSVersion   Single this function return OS type = 0 for Win32, 1 for Win95, 2 for WinNT
OSBuildNumber   Long  
OSType   Long  
Methods      
RASError   RASError set up a new pointer to RAS error object
Connections "Optional ByVal Index as Variant" Object if index is missing, set up a pointer to the collection of all the connections active at the RASEng object initialization; if index is passed, set up a pointer to the active connection with this index
PhoneEntries "Optional ByVal Index as Variant" Object if index is missing, set up a pointer to the collection of all the Remote Access entries founded at the RASEng object initialization; if index is passed, set up a pointer to the RA entry with this index
         
Connections     this object manipolate the collection of all the active connetions
Properties      
Count   Integer connections counter
Methods      
AddConnection strNewPhoneNumber as String strNewCallbackNumber as String strNewUsername as String strNewPassword as String strNewDomain as String boolAsync as Boolean" Connection add a new connection, calling the phone number via modem if needed; the boolAsync flag indicate if the program is stopped until the connection is activated (Async = false), or if the program may continue immediatly (Async = true)
RemoveConnection lngIndexToRem Long remove (close) the active conection of assigned index
         
Connection     an element in the connections object
Properties      
hRasConn   Long pointer to the RAS connection structure
EntryName   String  
Index   Integer index of the connection in the active connections list
State   Long state code
DeviceType   String  
DeviceName   String  
LANA   Byte  
WorkstationName   String  
IPXAddress   String  
IPAddress   String  
         
PhoneEntries     collection of the Remote Access entries
Properties      
Count   Integer number of entries founded
Methods      
AddEntry     activate the standard RAS add entry dialog
         
PhoneEntry     an element in the phoneentries object
Properties      
EntryName   String  
PhoneNumber   String  
CallbackNumber   String  
UserName   String  
Password   String  
Domain   String only for network entries
Index   Integer index of the entry in the entries list
Methods      
DialEntry "boolAsync as Boolean " Connection dial the selected entry; this method recall the AddConnection of the Conns object, passing all parameters from the entry selected
EditEntry     activate the standard RAS edit entry dialog
         
RASError     object for managing RAS errors
Properties      
ErrorNumber   Long return the RASEngine error code
Description   String return the RASEngine internal error string
Methods      
fcnRASErrorString   String return the string associated with the internal RASEngine error code
Clear     reset the RASEngine error code and string



Example programs


In VBRASENG.ZIP is included the example project TXRASENG : by creating a RASEngine object, list all the existing RAS entries, the active connections, and double-clicking on a RAS entry start a RAS connection, soon listed.

Mail contact