登录 注册
当前位置:主页 > 资源下载 > 14 > 开发Delphi的来电显示控件

开发Delphi的来电显示控件

  • 更新:2024-07-17 16:19:14
  • 大小:328KB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:Delphi - 后端
  • 格式:ZIP

资源介绍

开发来电显示的Delphi控件包: 使用方法: (1) 下载控件包Component.zip (2) 先编译 CPortLib6.dpk ,已安装了CPortLib 控件组的可省略这一步骤 (3) 然后编译 TelePort.dpk ,并安装 (4) 安装完成后,在 kosenTools 控件页增加了一个控件:TeleComport (5) 使用示例请看 Project2.dpr
示例源程序: unit Unit2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, CPort, TeleComportUnit;
type TForm1 = class(TForm) TeleComport1: TTeleComport; Memo1: TMemo; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; procedure Button2Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure TeleComport1Open(Sender: TObject); procedure TeleComport1Close(Sender: TObject); procedure TeleComport1Read(Sender: TObject; s: String; t: TDateTime); procedure Button4Click(Sender: TObject); procedure Button5Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation {$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject); begin if TeleComport1.SetupPort then Memo1.Lines.Add(\'Port=\'+TeleComport1.Port); //设置来电管理器的连接端口,USB端口的设置为Port:=\"USB\" end; procedure TForm1.Button1Click(Sender: TObject); begin TeleComport1.Open; end; procedure TForm1.Button3Click(Sender: TObject); begin TeleComport1.Close; end; procedure TForm1.TeleComport1Open(Sender: TObject); begin if TeleComport1.JDConnected then begin Memo1.Lines.Add(\'Connected\'); //打开端口时读取来电管理器内缓存的号码 TeleComport1.ReadAllWhenOpen; end; end; procedure TForm1.TeleComport1Close(Sender: TObject); begin if not TeleComport1.JDConnected then Memo1.Lines.Add(\'not Connected\'); end; //有来电时触发此事件 //s为来电号码,t为来电时间 procedure TForm1.TeleComport1Read(Sender: TObject; s: String; t: TDateTime); begin Memo1.Lines.Add(s+FormatDateTime(\' yyyy-mm-dd hh:nn:ss\', t)); end; procedure TForm1.Button4Click(Sender: TObject); begin Memo1.Lines.Add(\'RecordsCount=\'+IntToStr(TeleComport1.RecordsCount)); //未读来电次数 end; procedure TForm1.Button5Click(Sender: TObject); begin TeleComport1.ReadAllRecords; //读取所有缓存内的来电 end; end.