(****************************************** |******************************************
 * TDialUp, telefonicke pripojeni site    * |* TDialUp, Dial-Up Networking component  *
 *                pro Delphi 3/4 (32b)    * |*                for Delphi 3/4 (32b)    *
 *              (c) 1998,99 BEALsoft      * |*              (c) 1998,99 BEALsoft      *
 *                       v1.31            * |*                       v1.31            *
 *________________________________________* |*________________________________________*
 *    !! TATO KOMPONENTA JE ZDARMA !!     * |*     !! THIS COMPONENT IS FREE !!       *
 ****************************************** |******************************************)
// Autor // Author :
// aberka@usa.net / xberka1@fi.muni.cz, ICQ UIN 2365308, http://telman.cjb.net/ or http://come.to/~aberka

// Thanx to Davide Moretti for his RAS API header (Some code in this component
//  was written by him). You can reach him via e-mail: dmoretti@iper.net
// Also thanx to Magenta Systems ltd. for perfstats methods!

// News in v1.1 (since 1.0)
//   fixed bug - SetEntryUserName and SetEntryPassword
//   new - dynamic loading of dll, only when needed => you can add this component to
//         delphi on computer w/out RAS DLLs.
//
// News in v1.2 (since 1.1)
//   new - GetIP(<HANDLE_TO_CONNECTION>) fills properties ServerIP,ClientIP
//
// News in v1.3 (since 1.2)
//   new - In Win98, Win95 (with MSDUN 1.2 installed) and in WinNT you can get
//           transfer statistics. Except NT you can also get connection speed.
//           InitializePerfStats(BOOL,BOOL) - 1st BOOL - Get values immediately (similar to InitializePerfStats(TRUE,_); GetPerfStats;)
//                                            2nd BOOL - Don't use DUNA_KEY property,
//                                                       use 1st value found in registry {RECOMMENDED}
//                                                        // Available keys are in DUNA after calling SearchDUNA
//           GetPerfStats - write actual values into properties:
//                        - BytesXmit,BytesRecv,ConnectionSpeed
//
// New in 1.31 (since 1.3)
//   new - Portuguese translation

--------------------------------------------------------------------------------
// Chcete-li vyuzit komponentu v komercnim produktu, zaslete onen komercni
//   program autorovi (1 kopii zdarma). Nevyhovuje-li vam toto reseni, domluvte se
//   se mnou e-mailem.
// If you want to use this component in commercial product, send this 
//   product to author (1 copy for free). If you don't like this solution, mail me.
--------------------------------------------------------------------------------
// Nasledujici dokumentace je JEN v anglictine, protoze predpokladam u programatoru
// znalost anglictiny. Pokud popisu nerozumite, napiste dotazy na e-mail.

It is recommended to read the source code, its comments.

RAS API functions are described in WIN32.HLP (Shipped with 32b Delphi)

METHODS:
=======
function Dial : Integer;
  Dials <ENTRY> connection.
  Non-zero result means error; OnError event also occurs.
  
function GetEntries : Integer;
  Get available connections
  Connections are stored in <ENTRIES>. OnEntryGet event occurs 

function GetConnections : Integer;
  Get active connection
  Connections are passed thru OnActiveConnection

function HangUp : Integer;
  Hangups the connection you dialed with this component

function HangUpConn(Handle : THRasConn) : Integer;
  Hangups the connection identified by Handle (OnActiveConnection)

function CreateEntry : Integer;
  Creates entry in phonebook and displays edit dialog

function EditEntry : Integer;
  Opens edit dialog for <ENTRY>

function DeleteEntry : Integer;
  Delete <ENTRY> from phonebook

function RenameEntryTo(S : String) : Integer;
  Rename <ENTRY> to <S>

function SetEntryUserName(Value : String) : Integer;
  Set new username (<VALUE>) to <ENTRY>

function SetEntryPassword(Value : String) : Integer;
  Set new password (<VALUE>) to <ENTRY>

function RemovePassword : Integer;
  Remove password from <ENTRY>

function GetEntryUserName(var Value : String) : Integer;
  Get username from <ENTRY> to <VALUE>

function GetEntryPassword(var Value : String) : Integer;
  Get password from <ENTRY> to <VALUE>

function StatusString(State: TRasConnState; Error: Integer): String;
  Get string describing <STATE> and <ERROR>

function StatusStringCZ(State: TRasConnState; Error: Integer): String;
  Get Czech string describing <STATE> and <ERROR>

function GetIP(HRC : THRasConn) : Integer;
  Function puts Client and Server IP addresses to 
  ServerIP and ClientIP properties (see bellow)
function InitializePerfStats (start, search: boolean): boolean ;
  Function initializes Performance statistics (opens needed connections)
  Call this function before or immediately after connect.
  Start = get values immediately ? (RECOMMENDED TRUE)
  Search = In Win9X informations are stored in registry. The registry path is
	   is language dependent. If you understand this, put your own path into 
	   DUNA_KEY property. Setting search to true means component try to 
	   find the right path (selects 1st available). There may be also 2 paths 
	   or more. At this moment, I don't know, how to detect, which one is 
	   active, so you would set it manually. Available paths are stored in
	   DUNA property after calling SearchDUNA;
function SearchDUNA: Boolean;
  Function puts available paths of DialUpNetworkAdapters into
  DUNA property
function GetPerfStats: Boolean;
  Function retrieves performance statistics and puts them into
  BytesXmit,BytesRecv and ConnectionSpeed properties


PROPERTIES:
===========

property DialMode (TDialMode ... dmAsync/dmSync)
-----------------

Property describing the mode of dialing.
Async dialing means that user will be notified when anything happen
by event. See OnAsyncEvent. [onDialing,onError,onAsyncEvent]
Sync dialing means that Dial function will exit when dialing finished.
Dial function result gives neccessary information. [onDialing,onConnect,onNotConnected]

property Entry (String)
--------------

Identifies which entry will be processed by Dial,EditEntry,DeleteEntry,
  GetEntryUserName,...
  
property Language (TLanguage ... Czech/English/Portuguese)
-----------------

Choose your language. Used for events with string messages.


property ServerIP : String
  IP of server
property ClientIP : String
  IP of client (this) computer
property DUNA : TStringList
  List of available DialUpNetwork Adapters (needed for perfstats)
property DUNA_Key : String
  Choosen DUNA to use. Calling InitializePerfStats(...,TRUE) will
  write to this property 1st available DUNA. Calling InitializePerfStats(...,FALSE) will
  use this DUNA_KEY....
property BytesXmit : Cardinal
  GetPerfStats function stores here count of sent bytes from initialization
property BytesRecv : Cardinal
  GetPerfStats function stores here count of received bytes from initialization
property ConnectionSpeed : Cardinal
  GetPerfStats function stores here the connection speed


EVENTS:
=======

OnEntryGet, procedure (Sender : TObject; EntryName : Array of Char) of Object;
----------
This event occurs when an Entry was found in phonebook by GetEntris method.

OnDialing, procedure (Sender : TObject) of object;
---------
This event occurs when Dial method is executed.

OnConnect, procedure (Sender : TObject) of object;
---------
This event occrus when connected with Dial method.
                                      ^^^^^^^^^^^

OnNotConnected, procedure (Sender : TObject; ErrorCode : Integer; ErrorMessage : String) of object;
--------------
This event is called when dialing failed.


OnAsyncEvent, procedure (Sender : TObject; State : TRasConnState; Error : Integer;
------------             MessageText : String) of object;
This event is called by RAS when dialing in Async mode. Gives information
about current process.

OnError, procedure (Sender : TObject; ErrorCode : Integer; ErrorMessage : String) of Object;
-------
This event is called when error occur in Dial method etc.

OnActiveConnection, procedure (Sender : TObject; Handle : THRasConn; Status : TRasConnStatus;
------------------             StatusString : String;
                               EntryName, DeviceType, DeviceName : Array of Char) of object;

This event is called when an active connection was found by GetConnections.
Gives neccessary information about found connection.

Note:
-----
This component should work in Delphi 2.0, but it hasn't been tested.
Perhaps, some code changes will be necessary. Don't mail me if you
can't get this component working in Delphi 2.0 or lower.

P.S. If want some more information about the connection, try to
look in MODEMLOG.txt (in WIN95) or <MODEMNAME.log> (in WIN98)
Log filename is stored somewhere in registry....