RASManager.pas Written by Frank Plagge Copyright (c) 1998-2002 by Frank Plagge, Elsterweg 39, 38446 Wolfsburg, Germany All rights reserved ***************************************************************************** Remote Access external API Public header for external API clients ras.h - Copyright (c) 1992-1996, Microsoft Corporation, all rights reserved ***************************************************************************** Please send comments to plagge@wolfsburg.de V 1.01 - Aug 7th, 1998 first implementation, never trust a version 1.00 :-) V 1.02 - Aug 23th, 1998 + added real connected state the property Connected represents the connection state from RAS services. if the connection state for a service is needed simply set the property RASName and next check the poperty Connected. V 1.03 - Sep 29th, 1998 + fixed some uninititialized function results V 1.04 - Oct 17th, 1998 + minor changes + documentation completed - it's never complete :-) + first public release V 1.05 - Apr 1st 2002 + added getting the phone number of a RAS service V 1.10 - July 26th 2002 + complete new interface and internal design. now all available ras service can be managed by one instance ***************************************************************************** NO REPRESENTATIONS ARE MADE ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. NEITHER FRANK PLAGGE OR ANY OTHER PERSON SHALL BE LIABLE FOR ANY DAMAGES SUFFERED BY THE USE OF THIS SOFTWARE. ***************************************************************************** description: This is a component for an easy access to ras services. It includes connecting and disconnecting services as well as an easy access to important properties like connection state, IP numbers of client and server, phone number, aerea code, country code, device name, device type and a time stamp of the last connection state change. I know there are much more possibilities with RAS, but there is no time to implement all of them. ***************************************************************************** properties and events at design time: property OnConnect: TOnConnectionEvent read FOnConnect write FOnConnect; // connect event property OnConnecting: TOnConnectingEvent read FOnConnecting write FOnConnecting; // disconnect event property OnDisconnect: TOnConnectionEvent read FOnDisconnect write FOnDisconnect; // state change event during connection phase ***************************************************************************** properties and events at runtime: constructor Create(AOwner: TComponent); override; // create a new instance destructor Destroy; override; // destroy an existing instance procedure Connect( Index: Integer ); // connect a ras service procedure DisConnect(Index: Integer); // disconnect a ras service function IndexOf( Name: string ) : Integer; // get the index of a ras service by name procedure Start; // start the autorefresh mechanism procedure Stop; // stop the autorefresh mechanism property Count: Integer read GetCount; // get the number of available ras connections property AreaCode[Index: Integer]: string read GetAreaCode; // get area code by index property Connected[Index: Integer]: Boolean read GetConnected; // get connection state by index property CountryCode[Index: Integer]: Integer read GetCountryCode; // get countryCode by index property DeviceName[Index: Integer]: string read GetDeviceName; // get device name by index property DeviceType[Index: Integer]: string read GetDeviceType; // get device type by index property Handle[Index: Integer]: THRasConn read GetHandle; // get ras service handle by index property IPClient[Index: Integer]: string read GetIPClient; // get client ip number by index property IPServer[Index: Integer]: string read GetIPServer; // get server ip number by index property Name[Index: Integer]: string read GetName; // get connection name by index property PhoneNumber[Index: Integer]: string read GetPhoneNumber; // get phone number by index property TimeStamp[Index: Integer]: TDateTime read GetTimeStamp; // get state toggle timestamp by index property Version: string read GetVersion; ***************************************************************************** other very useful procedures function GetStatusString(State: Integer): string; // convert state to string message