zoukankan      html  css  js  c++  java
  • 怎样制作登录窗体

    ⑴让登录窗体在主窗体运行前打开,
    ⑵根据登录窗体返回值判断主窗体是否应该运行。
    详细代码如下:

    //project.dpr文件

    program project;
    ... ...
    ... ...

    begin
    Application.Initialize;


    EntryFrm:=TEntryFrm.Create(application); //登录窗口
    if EntryFrm.ShowModal=mrOK then //登录窗体关闭时返回了mrOK值,说明登录成功
    begin
    Application.CreateForm(TMainFrm, MainFrm);
    //其它auto-create forms
    end;
    EntryFrm.Free;
    application.Terminate


    Application.Title := '某某管理系统';
    Application.Run;
    end.





    //entry.pas 登录窗体文件
    var
    count:short; //登录次数

    {$R *.dfm}

    procedure TEntryFrm.BitBtn2Click(Sender: TObject);//取消登录
    begin
    application.Terminate;
    end;

    procedure TEntryFrm.BitBtn1Click(Sender: TObject);//确定登录
    begin
    Inc(count);
    ID:=edit1.Text; //帐号
    Pas:=edit2.Text; //密码;ID,Pas是全局变量


    //※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※//
    IDInfo.Open;
    if IDInfo.Locate('ID',ID,[]) then
    begin
    if StrEncry(IDInfo.FieldByName('Pas').AsString)=Pas then //密码解密,登录成功
    begin
    Pop:=IDInfo.fieldbyname('Pop').AsString; //取得权限
    writelog(ID,'登录'); //写入日志
    self.ModalResult:=mrOK; //关闭窗口并返回mrOK值
    end;
    end;
    if count>=3 then self.ModalResult:=mrabort; //只允许登录3次
    IDInfo.Close;
    //※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※//


    edit1.Text:='';
    edit2.Text:='';
    edit1.SetFocus;
    end;

  • 相关阅读:
    ubuntu 12.04 配置iscsi共享及挂载iscsi共享
    python_数据类型
    python_基本操作
    shell习题第5题:批量更改文件后缀名
    shell习题第4题:监控ip地址存活
    shell习题第3题:统计内存大小
    shell习题第2题:统计ip访问量
    shell习题第1题:每日一文件
    IIS网站的应用程序与虚拟目录的区别及应用
    http状态码
  • 原文地址:https://www.cnblogs.com/hssbsw/p/3159711.html
Copyright © 2011-2022 走看看