?? 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 + -