前一阵因为工作需要写了一个类来进行windows拨号,整理了一下,多封装了几个windows ras api,放上来大家提提意见。现在支持读取windows拨号连接列表、拨号、挂断、创建/删除连接,可以适用98/2000/XP,windows me 和NT没测试过,想来应该是可以的。以后有时间写成component,加入对拨号事件的支持。
uses ras, Classes, SysUtils, StrUtils, Windows, Forms;
type ERasError = Exception;
type TRASConnection = class private FPlatForm: integer; FConnected: Boolean; FRasEntries: TStringList; FRasConn: HRASCONN; FParams: RasDialParams; Ferrno: integer; function GetPassword: string; procedure SetPassword(Password: string); function GetPhoneNo: string; procedure SetPhoneNo(Number: string); function GetCallBack: string; procedure SetCallBack(Number: string); function GetDomain: string; procedure SetDomain(Domain: string); function GetUserName: string; procedure SetUserName(UserName: string); function GetEntryName: string; procedure SetEntryName(Entry: string); function GetConnected: Boolean; procedure SetConnected(AValue: Boolean); function GetRasEntries: TStringList; public property RasEntries: TStringList read GetRasEntries; property PhoneNumber: string read GetPhoneNo write SetPhoneNo; property CallBackNumber: string read GetCallBack write SetCallBack; property Domain: string read GetDomain write SetDomain; property EntryName: string read GetEntryName write SetEntryName; property username: string read GetUsername write SetUsername; property password: string read GetPassword write SetPassword; property Active: Boolean read GetConnected write SetConnected; procedure Connect; procedure DisConnect; function GetErrorCode: integer; procedure FreeAndHangup; constructor Create; reintroduce; destructor Destroy; override; procedure CreateRasEntry; procedure DeleteRasEntry(AEntryName: string);
复制本页网址和标题,发送给你QQ/Msn的好友一起分享
上一篇:Delphi中实现多线程同步查询
下一篇:对“网页内容查询控制”主题所得(下载):