panhua 发表于 2015-12-2 08:17:40

请问一下Delphi7 有人知道 怎样关闭登陆窗口 打开主窗口

我先打开,就是登陆窗口,怎么登陆窗口退出时,所有的各系也都关了,请鱼友们帮帮忙好吗?   在这里谢谢了!!!!
unit PHC_login;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TPHC_login1 = class(TForm)
    ComboBox1: TComboBox;
    Label1: TLabel;
    Label2: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    Label3: TLabel;
    CheckBox1: TCheckBox;
    procedure phclogin;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
//    procedure FormCreate(Sender: TObject);
private
    { Private declarations }
public
    { Public declarations }
end;

var
PHC_login1: TPHC_login1;

implementation
uses
PHC_DB,PHC_glxt;
var
abc:string;//新让ABC是一个字符串
i:Integer = 3 ; //I变成整数
s:boolean = false;   //S变成布尔值

{$R *.dfm}

procedure TPHC_login1.Button2Click(Sender: TObject);
begin
Close;
end;

procedure TPHC_login1.Button1Click(Sender: TObject);
begin
   if ComboBox1.Text='' then
    application.MessageBox('请输入用户名','提示',64)
else
if edit1.Text='' then
    application.MessageBox('请输入密码','提示',64)
else
    phclogin;
end;

procedure TPHC_login1.phclogin;
begin
with PHC_DB1.ADOQlogin1 do
   begin
      close;
      sql.Clear;
      sql.Add('select * from 用户信息表 where 用户名 = :a and 密码 = :b');
      parameters.ParamByName('a').Value:=trim(ComboBox1.Text);
      parameters.ParamByName('b').Value:=trim(edit1.Text);
      open;
   end;
      if PHC_DB1.ADOQlogin1.RecordCount>0 then
         begin
            abc:=PHC_DB1.ADOQlogin1.FieldByName('用户名').Value;
            s:=true;
            PHC_glxt1.StatusBar1.Panels.Text:=abc;
            PHC_glxt1.statusbar1.Panels.Text:=datetostr(date());
            PHC_glxt1.statusbar1.Panels.Text:=timetostr(time());
            PHC_glxt1.Show;
         end
      else
      begin
      i:= i - 1 ;

         if i < 1 then
            begin
               application.MessageBox('你输入密码次数以超过3次,系统将自动关闭!','提示',64);
               ComboBox1.Clear;
               edit1.Clear;
               ComboBox1.SetFocus;
               Close;
            end
         else

         begin
         Label3.Caption:='还有'+inttostr ( i )+' 机会';
         Label3.Visible:=True;
         edit1.text:='';
         end;

      end;


end;


end.

aishenwang 发表于 2015-12-2 16:34:17

panhua 发表于 2015-12-3 09:03:53

没有更好的办法了吗 ,隐藏可登陆窗口还是主窗口吖!!!!!

bowk 发表于 2015-12-3 22:47:04

那就 Tform.creat吧
關閉就 free巴

panhua 发表于 2015-12-5 08:30:56

谢谢 ,

大娘别摸我怕痒 发表于 2015-12-6 01:38:51

顶顶顶顶顶顶顶顶顶顶
页: [1]
查看完整版本: 请问一下Delphi7 有人知道 怎样关闭登陆窗口 打开主窗口