📄 unit1.pas
字号:
{*******************************************************}
{ }
{ 软件名 }
{ }
{ 版权所有 (C) 2008 山西拓扑信息技术工程有限公司 }
{ }
{*******************************************************}
//opentime时间一定要大于closetime
//本程序一定要连同xttimecs.ini一起放在easyadmin的目录下
//注意的问题是坐席在系统重启后的签到问题。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, TrayIcon, ImgList, inifiles, ExtCtrls, ComCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
TrayIcon1: TTrayIcon;
il1: TImageList;
Timer1: TTimer;
StatusBar1: TStatusBar;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
opentime: string;
closetime: string;
function reini(tit, path, smtit, con: string): string;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.reini(tit, path, smtit, con: string): string;
var
t: tinifile;
s: string;
begin
s := tit;
try
t := tinifile.Create(path);
reini := t.readstring(s, smtit, '');
finally
t.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
param: string;
begin
//param := Trim(Edit1.Text);
WinExec(PChar(param), SW_SHOWNORMAL);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
guan: HWND;
begin
guan := FindWindow('Afx:400000:0', nil); //Afx:400000:0为通力信通的CTI平台的类名
if guan <> 0 then
SendMessage(guan, WM_CLOSE, 0, 0);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
opentime := reini('sysoption', getcurrentdir + '\xttimecs.ini', 'opentime', '');
closetime := reini('sysoption', getcurrentdir + '\xttimecs.ini', 'closetime', '');
StatusBar1.Panels[0].Text:='开始时间:'+opentime;
StatusBar1.Panels[1].Text:='结束时间:'+closetime;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
mytime: TDateTime;
param: string;
guan: HWND;
begin
mytime := Now;
param:=getcurrentdir+'\easyadmin.exe';
if TimeToStr(mytime) = opentime then
begin
WinExec(PChar(param), SW_SHOWNORMAL);
end;
if TimeToStr(mytime) = closetime then
begin
guan := FindWindow('Afx:400000:0', nil); //Afx:400000:0为通力信通的CTI平台的类名
if guan <> 0 then
SendMessage(guan, WM_CLOSE, 0, 0);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -