C
cpilq
Unregistered / Unconfirmed
GUEST, unregistred user!
工程文件代码如下:
program SQsoft;
uses
Forms,
SQsofta in 'SQsofta.pas' {MDIMainForm},
SQsoftb in 'SQsoftb.pas' {FormChild1},
SQsoftpwa in 'SQsoftpwa.pas' {FormPassword},
ISQsoft in 'ISQsoft.pas' {FormFlash};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TFormFlash, FormFlash);
Application.CreateForm(TFormPassword, FormPassword);
Application.Run;
end.
启动界面代码如下:
unit ISQsoft;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, jpeg, ExtCtrls;
type
TFormFlash = class(TForm)
Image1: TImage;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormFlash: TFormFlash;
implementation
uses SQsofta, SQsoftb, SQsoftpwa;
{$R *.dfm}
procedure TFormFlash.Timer1Timer(Sender: TObject);
begin
FormFlash.Hide;
FormFlash.Free;
FormPassword.ShowModal;
end;
end.
登陆界面代码如下:
unit SQsoftpwa;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DBCtrls, ExtCtrls, Buttons, DB, ADODB, Mask;
type
TFormPassword = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
ComboBox1: TComboBox;
MaskEdit1: TMaskEdit;
procedure BitBtn2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormPassword: TFormPassword;
implementation
uses ISQsoft, SQsofta, SQsoftb;
{$R *.dfm}
procedure TFormPassword.BitBtn2Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TFormPassword.FormShow(Sender: TObject);
begin
Combobox1.Items.Add('管理员');
Combobox1.Text:='管理员';
Combobox1.ItemIndex:=1;
Combobox1.Items.Add('会计');
Combobox1.Text:='会计';
Combobox1.ItemIndex:=2;
Combobox1.Items.Add('出纳');
Combobox1.Text:='出纳';
Combobox1.ItemIndex:=3;
end;
procedure TFormPassword.BitBtn1Click(Sender: TObject);
var
SQL_Cmd:string;
begin
sql_cmd:='select id,pw from pwa ';
sql_cmd:=sql_cmd+'where id='+#39+trim(combobox1.text)+#39;
sql_cmd:=sql_cmd+'and pw='+#39+trim(maskedit1.Text)+#39;
if (Combobox1.Text<>ADOQuery1.Fieldvalues['id']) or
(Maskedit1.Text<>ADOQuery1.Fieldvalues['pw']) then
showmessage('您的口令不正确,请重新输入')
else
begin
Formpassword.Hide;
MDIMainForm.Show;
end;
end;
end.
在输入正确口令的情况下。出现一下消息框
Access violation at address 0045e3d2 in module 'SQsoft.exe'.Read of address
000002f4
确定之后没有调用MDIMainForm.登陆界面也消失,只有程序进程。
在没有输入口令直接点击登陆按键的时候,出现showmessage里面的信息之后,也同样消失,
留下进程。
如果把登陆按键的代码改成直接启动MDIMainForm的话!没有将FormChild1调用出来!只有MDIM
ainForm而已!
在下是delphi初学者!请各位富翁帮忙!在线等待!
program SQsoft;
uses
Forms,
SQsofta in 'SQsofta.pas' {MDIMainForm},
SQsoftb in 'SQsoftb.pas' {FormChild1},
SQsoftpwa in 'SQsoftpwa.pas' {FormPassword},
ISQsoft in 'ISQsoft.pas' {FormFlash};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TFormFlash, FormFlash);
Application.CreateForm(TFormPassword, FormPassword);
Application.Run;
end.
启动界面代码如下:
unit ISQsoft;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, jpeg, ExtCtrls;
type
TFormFlash = class(TForm)
Image1: TImage;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormFlash: TFormFlash;
implementation
uses SQsofta, SQsoftb, SQsoftpwa;
{$R *.dfm}
procedure TFormFlash.Timer1Timer(Sender: TObject);
begin
FormFlash.Hide;
FormFlash.Free;
FormPassword.ShowModal;
end;
end.
登陆界面代码如下:
unit SQsoftpwa;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DBCtrls, ExtCtrls, Buttons, DB, ADODB, Mask;
type
TFormPassword = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
ComboBox1: TComboBox;
MaskEdit1: TMaskEdit;
procedure BitBtn2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormPassword: TFormPassword;
implementation
uses ISQsoft, SQsofta, SQsoftb;
{$R *.dfm}
procedure TFormPassword.BitBtn2Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TFormPassword.FormShow(Sender: TObject);
begin
Combobox1.Items.Add('管理员');
Combobox1.Text:='管理员';
Combobox1.ItemIndex:=1;
Combobox1.Items.Add('会计');
Combobox1.Text:='会计';
Combobox1.ItemIndex:=2;
Combobox1.Items.Add('出纳');
Combobox1.Text:='出纳';
Combobox1.ItemIndex:=3;
end;
procedure TFormPassword.BitBtn1Click(Sender: TObject);
var
SQL_Cmd:string;
begin
sql_cmd:='select id,pw from pwa ';
sql_cmd:=sql_cmd+'where id='+#39+trim(combobox1.text)+#39;
sql_cmd:=sql_cmd+'and pw='+#39+trim(maskedit1.Text)+#39;
if (Combobox1.Text<>ADOQuery1.Fieldvalues['id']) or
(Maskedit1.Text<>ADOQuery1.Fieldvalues['pw']) then
showmessage('您的口令不正确,请重新输入')
else
begin
Formpassword.Hide;
MDIMainForm.Show;
end;
end;
end.
在输入正确口令的情况下。出现一下消息框
Access violation at address 0045e3d2 in module 'SQsoft.exe'.Read of address
000002f4
确定之后没有调用MDIMainForm.登陆界面也消失,只有程序进程。
在没有输入口令直接点击登陆按键的时候,出现showmessage里面的信息之后,也同样消失,
留下进程。
如果把登陆按键的代码改成直接启动MDIMainForm的话!没有将FormChild1调用出来!只有MDIM
ainForm而已!
在下是delphi初学者!请各位富翁帮忙!在线等待!