📄 sys_login.pas
字号:
unit sys_login;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls, DB, ADODB ;
type
TFrm_sys_login = class(TForm)
Img_Background: TImage;
Timer1: TTimer;
Lb_MyText: TLabel;
Lb_time: TLabel;
Lb_Warning: TLabel;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
private
hhk: array[0..wh_max] of hhook;
hdll: HMODULE;
hfunction: FARPROC;
{ Private declarations }
public
{ Public declarations }
end;
var
Frm_sys_login: TFrm_sys_login;
implementation
uses DllDef, ucomm, sys_global, fmain ;
{$R *.dfm}
var
t: integer ;
tms : integer ;
procedure pshook(hk:hhook;index:integer); stdcall; external 'HOOKDLL.DLL';
procedure TFrm_sys_login.FormCreate(Sender: TObject);
var
str: string ;
begin
{ str := ExtractFilePath(application.ExeName);
str := str + 'guest.jpeg' ;
try
Img_Background.Picture.LoadFromFile(str); // 加载照片
except
messagebox(handle, '没有图片文件guest.jpeg', '提示', mb_ok+mb_iconstop);
end;
}
end;
procedure TFrm_sys_login.FormShow(Sender: TObject);
var
pv: integer ;
Wnd: THandle ;
begin
Frm_sys_login.BringToFront;
t := 0 ;
tms := m_sdTime * 60 * 1000; //将关机分钟数转化为微秒数
// Lb_Warning.Caption := '' ;
// Lb_MyText.Caption := '' ;
//if m_stop<>'9' then lb_warning.caption := '';
lb_warning.Visible := m_stop='9';
Wnd := FindWindow('shell_TrayWnd', nil);
if Wnd <> 0 then ShowWindow(Wnd, SW_HIDE); // 隐藏任务栏
if m_VerId = 1 then begin // 若系统是Win98, 则禁止系统键
systemParametersinfo(SPI_SCREENSAVERRUNNING,1,@pv,0);
end;
// 锁定键盘
frm_sys_login.Cursor := crDefault ;
hdll:=LoadLibraryEx('HOOKDLL.DLL',0,0);
hFUNCTION:=GetProcAddress(HDLL,'HOOKKEYBOARD');
hhk[WH_KEYBOARD]:=SetWindowsHookEx(WH_KEYBOARD,TFNHookProc(HFUNCTION),HDLL,0);
pshook(hhk[WH_KEYBOARD],WH_KEYBOARD);
hFUNCTION:=GetProcAddress(HDLL,'HOOKCBT');
hhk[WH_CBT]:=SetWindowsHookEx(WH_CBT,TFNHookProc(HFUNCTION),HDLL,0);
pshook(hhk[WH_CBT],WH_CBT);
// 锁定鼠标
hFUNCTION:=GetProcAddress(HDLL,'HOOKMOUSE');
hhk[WH_MOUSE]:=SetWindowsHookEx(WH_MOUSE,TFNHookProc(HFUNCTION),HDLL,0);
pshook(hhk[WH_MOUSE],WH_MOUSE);
frm_sys_login.Cursor := crDefault ;
if m_stop = '9' then // 网络不通时
m_DateTime := now
else
m_DateTime := ServerDateTime ; // 得到服务器当前的时间
timer1.enabled:=true;
end;
procedure TFrm_sys_login.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := false ; // 计时器停止工作
timer1.Interval := 800;
lb_warning.Width:=width-2;
lb_mytext.Width:=width-2;
lb_time.Width:=width-2;
t := t + 1000 ;
if t < tms then
Lb_Time.Caption := '不然 '+intTostr((tms-t) div 1000)+' 秒后, 电脑将自动关机'
else begin
modalresult := mrcancel;
exit;
end;
if ChkCard(m_com)<>0 then begin
// Lb_MyText.Caption := '请插入您的IC卡!' ;
timer1.enabled:=true;
exit;
end;
// 若发现IC卡
if CardInfo(m_ICtype, m_ICno, m_ICmoney, m_ICdateTime)= 0 then // 读卡成功
begin
// 挂失卡审核
if (m_stop='9') and (m_ictype<>'5') then begin
timer1.enabled:=true;
exit;
end;
if m_Stop <> '9' then begin // 如果网络通的话
with f_main.Qry_tmp1 do
begin
close;
sql.Text := 'select icno from card where icno = '+ intTostr(strToint(m_icno));
try
open ;
if recordcount=0 then begin
Lb_Time.Caption := '该卡是无效卡' ;
Timer1.Enabled := true ;
exit;
end;
except
m_stop:='9';
end;
end;
end;
if m_ICtype = '5' then
begin // 若为系统卡, 则退出执行
m_ShowStop := '1' ; // 当卡上金额小于1时, 取消自动显示
if m_stop='9' then m_StartTime := now else m_StartTime := ServerDateTime ; // 确定开始的时间
m_StartMin := GetTickCount div 1000 ; // 当前的秒数
m_StMoney := m_ICmoney ; // 插卡后, 获取的金额
modalresult:=mrok; // 关闭该窗口
exit ;
end ;
if m_ICdateTime >= m_Datetime then begin // 非精确做法
if (m_ICmoney >0.1) then begin // 若卡上有钱, 或是管理卡
m_StartTime := ServerDateTime ; // 确定开始的时间
m_StartMin := GetTickCount div 1000 ; // 当前的秒数
m_StMoney := m_ICmoney ; // 插卡后, 获取的金额
modalresult:=mrok;
exit; // 关闭该窗口
end else
Lb_Time.Caption := '卡上已无钱可用, 请到前台充值!';
end else
Lb_Time.caption := '该卡已过有效期, 为无效IC卡';
end else
Lb_Time.Caption := '卡插反或卡无效, 请通知服务台!';
Timer1.Enabled := true ; // 激活计时器
end;
procedure TFrm_sys_login.FormClose(Sender: TObject;
var Action: TCloseAction);
var
Wnd: THandle ;
pv: integer ;
begin
try
Wnd := FindWindow('shell_TrayWnd', nil);
if Wnd <> 0 then ShowWindow(Wnd, SW_SHOW); // 显示任务栏
if m_VerId = 1 then begin // 释放系统键
systemParametersinfo(SPI_SCREENSAVERRUNNING,0,@pv,0);
end;
UnhookWindowsHookEx(hhk[WH_KEYBOARD]); // 激活键盘
UnhookWindowsHookEx(hhk[WH_MOUSE]); // 激活鼠标
UnhookWindowsHookEx(hhk[WH_CBT]); // 激活BUTTON-START
FREELIBRARY(HDLL);
if m_ICtype = '5' then EnabControl else DisaControl ; // 禁止-激活安全设置
release;
except
showmessage('sss');
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -