提
提问富翁
Unregistered / Unconfirmed
GUEST, unregistred user!
环境:
我想在主窗口显示前先出现密码窗口,来进行身份验证,然后决定进入。
MDIAPP代码:
begin
Application.Initialize;
flash:=tflash.Create(application);//启动画面
flash.Show;
flash.Update;
while flash.Timer1.Enabled do
application.ProcessMessages;
Application.CreateForm(TMainForm, MainForm);主窗口
pass:=tpass.Create(application);//密码窗口
pass.ShowModal;//问题可能在次-显示
flash.Hide;
flash.Free;
Application.Run;
密码窗口确定按钮代码:
var
name:string;
begin
if (pascombobox.text='') or (pasedit.text='') then showmessage('Óû§ÃûÓëÃÜÂë¿ò²»ÄÜΪ¿Õ')
else
begin
pasquery.sql.clear;
pasquery.sql.add('select ÃÜÂë from pass');
pasquery.sql.add('where ̞=:name');
pasquery.ParamByName('name').asstring:=pascombobox.text;
pasquery.Open;
if pasquery.FieldByName('ÃÜÂë').AsString=pasedit.text then
begin
usename:=pascombobox.Text;
usepass:=pasedit.Text;
mainform.Showmodal;//显示主窗口
end
else
begin
showmessage('Óû§ÃûÓëÃÜÂë²»¶ÔÓ¦');
end;
end;
end;
问题(1)
密码对话对话框关闭时出错;
(2)
主窗口关闭了但是程序没有结束,同时不能最小化。
我想在主窗口显示前先出现密码窗口,来进行身份验证,然后决定进入。
MDIAPP代码:
begin
Application.Initialize;
flash:=tflash.Create(application);//启动画面
flash.Show;
flash.Update;
while flash.Timer1.Enabled do
application.ProcessMessages;
Application.CreateForm(TMainForm, MainForm);主窗口
pass:=tpass.Create(application);//密码窗口
pass.ShowModal;//问题可能在次-显示
flash.Hide;
flash.Free;
Application.Run;
密码窗口确定按钮代码:
var
name:string;
begin
if (pascombobox.text='') or (pasedit.text='') then showmessage('Óû§ÃûÓëÃÜÂë¿ò²»ÄÜΪ¿Õ')
else
begin
pasquery.sql.clear;
pasquery.sql.add('select ÃÜÂë from pass');
pasquery.sql.add('where ̞=:name');
pasquery.ParamByName('name').asstring:=pascombobox.text;
pasquery.Open;
if pasquery.FieldByName('ÃÜÂë').AsString=pasedit.text then
begin
usename:=pascombobox.Text;
usepass:=pasedit.Text;
mainform.Showmodal;//显示主窗口
end
else
begin
showmessage('Óû§ÃûÓëÃÜÂë²»¶ÔÓ¦');
end;
end;
end;
问题(1)
密码对话对话框关闭时出错;
(2)
主窗口关闭了但是程序没有结束,同时不能最小化。