320 lines
7.8 KiB
ObjectPascal
320 lines
7.8 KiB
ObjectPascal
![]() |
unit logon;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, Buttons, ExtCtrls, MovePanel,ADODB, DB, ComCtrls,
|
|||
|
ToolWin;
|
|||
|
|
|||
|
type
|
|||
|
TFormLogon = class(TForm)
|
|||
|
Timer1: TTimer;
|
|||
|
MovePanel1: TMovePanel;
|
|||
|
Label1: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
Edit2: TEdit;
|
|||
|
Label3: TLabel;
|
|||
|
ToolBar1: TToolBar;
|
|||
|
BtnOk: TToolButton;
|
|||
|
BtnQuit: TToolButton;
|
|||
|
ToolButton12: TToolButton;
|
|||
|
ToolBar2: TToolBar;
|
|||
|
ToolButton6: TToolButton;
|
|||
|
ToolButton7: TToolButton;
|
|||
|
ToolButton8: TToolButton;
|
|||
|
ToolButton9: TToolButton;
|
|||
|
ToolButton10: TToolButton;
|
|||
|
ToolButton11: TToolButton;
|
|||
|
ToolButton19: TToolButton;
|
|||
|
ToolButton20: TToolButton;
|
|||
|
ToolButton21: TToolButton;
|
|||
|
ToolButton25: TToolButton;
|
|||
|
ToolBar3: TToolBar;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
ToolButton13: TToolButton;
|
|||
|
ToolButton14: TToolButton;
|
|||
|
ToolButton15: TToolButton;
|
|||
|
ToolButton16: TToolButton;
|
|||
|
ToolButton17: TToolButton;
|
|||
|
ToolButton18: TToolButton;
|
|||
|
ADQ_Tmp: TADOQuery;
|
|||
|
ToolButton22: TToolButton;
|
|||
|
ToolButton24: TToolButton;
|
|||
|
Edit1: TComboBox;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ToolButton23: TToolButton;
|
|||
|
procedure btnoClick(Sender: TObject);
|
|||
|
procedure Form(Sender: TObject; var Key: Word;
|
|||
|
Shift: TShiftState);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure BtnOkClick(Sender: TObject);
|
|||
|
procedure FormKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure Timer1Timer(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|||
|
procedure BtnQuitClick(Sender: TObject);
|
|||
|
procedure Edit2KeyDown(Sender: TObject; var Key: Word;
|
|||
|
Shift: TShiftState);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure FormActivate(Sender: TObject);
|
|||
|
procedure Edit1Exit(Sender: TObject);
|
|||
|
procedure ToolButton13Click(Sender: TObject);
|
|||
|
procedure ToolButton23Click(Sender: TObject);
|
|||
|
procedure ComboBox1Exit(Sender: TObject);
|
|||
|
procedure ToolButton12Click(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
FormLogon: TFormLogon;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
Spmain,AES,ElAES,U_upPassword;
|
|||
|
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TFormLogon.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
Edit1.Text := '';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
with ADQ_Tmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select distinct A.UserID from SY_Purview A ');
|
|||
|
SQL.Add('inner join SY_User B on B.UserID=A.UserID ');
|
|||
|
sql.Add('where A.ModuleSubId=''99'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
Edit1.Items.Clear;
|
|||
|
with ADQ_Tmp do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
Edit1.Items.Add(Trim(fieldbyname('UserId').AsString));
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Edit1.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := CaFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.Form(Sender: TObject; var Key: Word;
|
|||
|
Shift: TShiftState);
|
|||
|
begin
|
|||
|
if Key = 13 then
|
|||
|
begin
|
|||
|
PostMessage(Handle,WM_KEYDOWN,VK_TAB,0);
|
|||
|
Key := 0;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.btnoClick(Sender: TObject);
|
|||
|
begin
|
|||
|
application.Terminate;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.BtnOkClick(Sender: TObject);
|
|||
|
type
|
|||
|
TMyFunc = function(App:Tapplication; FormH:hwnd; FormID:integer;
|
|||
|
Language: integer; WinStyle:integer;
|
|||
|
GCode: Pchar; GName: Pchar; DataBase:Pchar;Title:PChar;
|
|||
|
Parameters1:PChar;Parameters2:PChar;Parameters3:PChar;Parameters4:PChar;
|
|||
|
Parameters5:PChar;Parameters6:PChar;Parameters7:PChar;Parameters8:PChar;
|
|||
|
Parameters9:PChar;Parameters10:PChar;DataBaseStr:PChar):hwnd;stdcall;
|
|||
|
var
|
|||
|
Tf: TMyFunc;
|
|||
|
Tp: TFarProc;
|
|||
|
Th:Thandle;
|
|||
|
newh:hwnd;
|
|||
|
bm,mm,mz,mm2:string;
|
|||
|
begin
|
|||
|
if (Edit1.Text='') then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>ʺ<EFBFBD>û<EFBFBD><C3BB>¼<EFBFBD><C2BC>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>롣', '<27><>Ϣ<EFBFBD><CFA2>ʾ', MB_OK or MB_ICONinformation);
|
|||
|
Edit1.SetFocus;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
with ADQ_Tmp do
|
|||
|
begin
|
|||
|
sql.Clear;
|
|||
|
sql.add('SELECT userid,username,password FROM SY_User WHERE userid='+''''+trim(Edit1.Text)+'''');
|
|||
|
Open;
|
|||
|
IF not ADQ_Tmp.IsEmpty then
|
|||
|
begin
|
|||
|
bm:=Fields[0].AsString;
|
|||
|
mz:=Fields[1].AsString;
|
|||
|
mm:=Trim(Fields[2].AsString);
|
|||
|
if Trim(mm)<>'' then
|
|||
|
mm2:=Trim(DecryptString(Trim(mm),'ljb^0122!@#*&^%$',kb128))
|
|||
|
else
|
|||
|
mm2:='';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox('û<>д<EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
close;
|
|||
|
end;
|
|||
|
|
|||
|
if (mm2=trim(edit2.text)) and (bm<>'') then
|
|||
|
begin
|
|||
|
FormMain.StatusBar1.Panels[1].Text:='<27><><EFBFBD><EFBFBD>Ա:'+mz;
|
|||
|
FormMain.StatusBar1.Panels[2].Text:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾';
|
|||
|
User_Name:=trim(mz);
|
|||
|
User_Id:=trim(bm);
|
|||
|
|
|||
|
// fuserName:=trim(ADOQueryTmp.fieldbyname('userName').AsString);
|
|||
|
Th := LoadLibrary('FileUpdate.dll');
|
|||
|
if Th > 0 then
|
|||
|
begin
|
|||
|
try
|
|||
|
Tp := GetProcAddress(Th, 'GetDllForm');
|
|||
|
if Tp <> nil then
|
|||
|
begin
|
|||
|
Tf := TMyFunc(Tp);
|
|||
|
newh:=Tf(Application,0,2,0,0,
|
|||
|
PChar(User_Id),
|
|||
|
PChar(User_Name),PChar(''),PChar(''),PChar(''),PChar(''),'','','','','','','','',PChar(ConDateBaseString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
//ShowMessage('<27><>ӡִ<D3A1>д<EFBFBD><D0B4><EFBFBD>');
|
|||
|
end;
|
|||
|
finally
|
|||
|
FreeLibrary(Th);
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
ShowMessage('<27>Ҳ<EFBFBD><D2B2><EFBFBD>FileUpdate.dll');
|
|||
|
end;
|
|||
|
FormLogon.close;
|
|||
|
FormMain.Show;
|
|||
|
end
|
|||
|
else
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>Ϣ<EFBFBD><CFA2>ʾ', MB_OK or MB_ICONinformation);
|
|||
|
|
|||
|
{FormLogon.close;
|
|||
|
FormMain.Show;}
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.FormKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
{key:=UpCase(key);
|
|||
|
if (Key in ['''']) then
|
|||
|
Key := #0;
|
|||
|
if FormLogon.Visible then
|
|||
|
begin
|
|||
|
if key=#13 then
|
|||
|
begin
|
|||
|
key:=#0;
|
|||
|
FormLogon.perform(WM_NEXTDLGCTL,0,0);
|
|||
|
end;
|
|||
|
|
|||
|
end;}
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.Timer1Timer(Sender: TObject);
|
|||
|
begin
|
|||
|
Edit1.Text:='';
|
|||
|
Edit2.Text:='';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|||
|
begin
|
|||
|
if User_ID='' then application.Terminate;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.BtnQuitClick(Sender: TObject);
|
|||
|
begin
|
|||
|
application.Terminate;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.Edit2KeyDown(Sender: TObject; var Key: Word;
|
|||
|
Shift: TShiftState);
|
|||
|
begin
|
|||
|
if Key = VK_Return then
|
|||
|
BtnokClick(sender);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.FormActivate(Sender: TObject);
|
|||
|
begin
|
|||
|
Edit1.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.Edit1Exit(Sender: TObject);
|
|||
|
begin
|
|||
|
edit1.Text :=upperCase(trim(edit1.text))
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.ToolButton13Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Edit2.Text:=Trim(Edit2.Text)+Trim(TToolButton(Sender).Caption);
|
|||
|
Edit2.SelectAll;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.ToolButton23Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Length(Trim(Edit2.Text))=0 then Exit;
|
|||
|
Edit2.Text:=Copy(Trim(Edit2.Text),1,Length(Trim(Edit2.Text))-1);
|
|||
|
Edit2.SelectAll;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.ComboBox1Exit(Sender: TObject);
|
|||
|
begin
|
|||
|
edit1.Text :=upperCase(trim(edit1.text))
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.ToolButton12Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(Edit1.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>ʺŲ<CABA><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
frmupPassword:=TfrmupPassword.Create(Application);
|
|||
|
with frmupPassword do
|
|||
|
begin
|
|||
|
fuserID:=Trim(Self.Edit1.Text);
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmupPassword.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TFormLogon.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Length(Trim(Edit2.Text))=0 then Exit;
|
|||
|
Edit2.Text:=Copy(Trim(Edit2.Text),1,Length(Trim(Edit2.Text))-1);
|
|||
|
Edit2.SelectAll;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|