procedure TLog_Form.SpeedButton1Click(Sender: TObject);
var username ,password :string ;
Dq,ErrorInfo, Qx, user_num,rpqx: OleVariant ;
begin
if edit1.Text='' then
begin
MessageDlg('请输入用户名称!',mtError,[mbOK],0);
exit;
end;
username:=trim(edit1.text) ;
if edit2.Text='' then
begin
MessageDlg('请输入用户密码!',mtError,[mbOK],0);
exit;
end;
password :=trim(edit2.text) ;
try
statusbar1.Panels[1].Text :='正在连接....';
if Main_form.ConnectionBroker1.Connected=false then
Main_form.ConnectionBroker1.Connected :=true ;
statusbar1.Panels[1].Text :='连接成功....';
main_form.StatusBar1.Panels[1].Text :='目前以连接到中间件';
main_form.StatusBar1.Panels[9].Text :='用户登录';
if main_form.ConnectionBroker1.AppServer.CheckUser(username,password,dq,errorinfo,qx,user_num,rpqx) then
begin
main_form.Edit1.Text :=username ;
main_form.StatusBar1.Panels[9].Text :=user_num ;
main_form.SpeedButton2Click(main_form);
log_form.Close ;
end else
begin
main_form.Logined :=false ;
statusbar1.Panels[1].Text :='连接失败,请重试!';
if main_form.ConnectionBroker1.Connected then main_form.ConnectionBroker1.Close ;
MessageDlg(ErrorInfo,mtError, [mbYes], 0);
end;
except
on e:exception do
begin
if Main_form.ConnectionBroker1.Connected then Main_form.ConnectionBroker1.Close;
begin
MessageDlg('登录失败:'+E.Message,mtError, [mbYes], 0);
main_form.StatusBar1.Panels[1].Text :='';
end;
end;
end;
end;
每次用户登陆时候,登陆界面总是会变成白色,直到登陆成功才好,我想开一个线程来做,怎么做呢?
var username ,password :string ;
Dq,ErrorInfo, Qx, user_num,rpqx: OleVariant ;
begin
if edit1.Text='' then
begin
MessageDlg('请输入用户名称!',mtError,[mbOK],0);
exit;
end;
username:=trim(edit1.text) ;
if edit2.Text='' then
begin
MessageDlg('请输入用户密码!',mtError,[mbOK],0);
exit;
end;
password :=trim(edit2.text) ;
try
statusbar1.Panels[1].Text :='正在连接....';
if Main_form.ConnectionBroker1.Connected=false then
Main_form.ConnectionBroker1.Connected :=true ;
statusbar1.Panels[1].Text :='连接成功....';
main_form.StatusBar1.Panels[1].Text :='目前以连接到中间件';
main_form.StatusBar1.Panels[9].Text :='用户登录';
if main_form.ConnectionBroker1.AppServer.CheckUser(username,password,dq,errorinfo,qx,user_num,rpqx) then
begin
main_form.Edit1.Text :=username ;
main_form.StatusBar1.Panels[9].Text :=user_num ;
main_form.SpeedButton2Click(main_form);
log_form.Close ;
end else
begin
main_form.Logined :=false ;
statusbar1.Panels[1].Text :='连接失败,请重试!';
if main_form.ConnectionBroker1.Connected then main_form.ConnectionBroker1.Close ;
MessageDlg(ErrorInfo,mtError, [mbYes], 0);
end;
except
on e:exception do
begin
if Main_form.ConnectionBroker1.Connected then Main_form.ConnectionBroker1.Close;
begin
MessageDlg('登录失败:'+E.Message,mtError, [mbYes], 0);
main_form.StatusBar1.Panels[1].Text :='';
end;
end;
end;
end;
每次用户登陆时候,登陆界面总是会变成白色,直到登陆成功才好,我想开一个线程来做,怎么做呢?
解决方案 »
- 关于调用 dll 的回调函数封装到控件的事件?
- DELPHI判断文件是否打开 这样写正确吗?
- 100分求一个V9.0版本以上的ModelMaker Pascal Edition for Delphi(V9.0的也可以)
- delphi2006的BUG
- 请问怎样将TTreeView控件中显示的数据作为查询条件,在TListView控件中显示数据库中满足条件的结果。多谢了!
- 程序打包的问题,请进。谢谢
- 100 分提问有关ShowModal 的两个问题
- 怎样用TCP协议传输多媒体文件,比如mp3,或者.RM文件(较大)?
- 如何作出类似history kill 中的boss -key功能
- 用Delphi混饭吃能维持多久?
- 发布BDE时无oracle驱动,请做过BDE发布的高手指点,100分相送
- bde连接也出错,以前一直是可以的,怪!!!哪位知道的?
应该没必要,合理用refresh事件即可!
//------------------------开线程例子-
function other_DealDataProg(P:pointer):Longint;stdcall;
begin//加入你的处理代码即可!
end;
procedure TForm_setup.Button1Click(Sender: TObject);
var hThread:Thandle;//定义一个句柄
ThreadID:longword;
begin
hthread:=CreateThread(nil,0,@other_DealDataProg,nil,0,ThreadID);
if hThread=0 then
showmessage('安装操作失败!');
end;