我想是Application.Terminate 的原因,因为DELPHI编译的时候会将这句话提前考虑进去的。

解决方案 »

  1.   

    直接主窗体CLOSE就行了,Application.Terminate 干什么的?望赐教
      

  2.   

    这样退出:      MainMenufrm.Onshow :=nil;
          MainMenufrm.OnActivate :=nil;
          Application.Terminate; //程序终止
          Application.ProcessMessages;
      

  3.   

    你试一下这样
      if 用户名和密码匹配 then
        Succ:=true
      else
        Succ:=false;  close;在窗口的onClose事件中
      if not Succ then
        Application.terminate;
      

  4.   

    也许你可以改成这样:
    procedure TfrmUserLogin.BitBtn1Click(Sender: TObject);
    var
      strSqlString: String;
    begin
      strSqlString:= 'Select [User_Password] From [User_Information] Where [User_Name]='''+ edtUserName.Text+''';
      DM.DoQuery(strSqlString, frmDM.adoquery);
    // if (frmDM.adoquery.bof And frmDM.adoquery.Eof) then
    if frmDM.adoquery.FieldByName('User_Password').asstring=edtPassword.Text  then
      显示主窗体
    else begin
       showmessage('用户和密码不正确');
       Application.Terminate;
     end
    end;
      

  5.   

    你可以在登陆窗口上放一个TABLE,用DATABASE DESKTOP建一个含有用户名和密码两个字段的表,利用登陆对话框中的用户和密码进行验证,当然表格中存储的就是你的用户名和密码,我是这样做的,这样做的好处就是密码是动态的可以附加修改密码模块就可以对用户名和密码进行日常维护,可能这样做不是太安全的,但我的几本书均未提到密码登陆框的编辑方法,所以我想了半天才想到这个方法,不知这样的登陆对话框思路对你有没有帮助。
      

  6.   

    procedure TfrmUserLogin.BitBtn1Click(Sender: TObject);
    var
      strSqlString: String;
    begin
      strSqlString:= 'Select * From [User_Information] Where [User_Name]='''+
        edtUserName.Text+''' And [User_Password]='''+
        edtPassword.Text+'''';
      DM.DoQuery(strSqlString, frmDM.adoquery);
     if (frmDM.adoquery.bof And frmDM.adoquery.Eof) then
     begin
       showmessage('用户和密码不正确');
       halt;//用这个不停也得停了
     end
    end;