我想在mdi应用程序的主框架显示之后弹出系统登陆的对话框,合法用户进入,不合法用户退出,请问应该在主窗体的什么事件中处理这个动作,给我代码

解决方案 »

  1.   

    在项目文件中可以写:  Application.CreateForm(TfrmMain, frmMain);
      Application.Initialize;
      with TfrmLogin.Create(Application) do
      begin
        ShowModal;
        if (UserName = ...) and (PassWord = ...) then
        begin
          Close ;
          Application.Run ;
        end
        else 
          Application.Terminate ; 
     end;
      

  2.   

    也可以在MDIForm中放个Timer控件。建立MDIForm时,设置Timer.Enabled:=True在Timer事件中:Timer.Enabled:=False;with TfrmLogin.Create(Application) do
      begin
        ShowModal;
        if (UserName = ...) and (PassWord = ...) then
        begin
          Close ;
          Application.Run ;
        end
        else 
          Application.Terminate ; 
     end;
      

  3.   

    以上两种方法都是在主框架显示之"后"弹出系统登陆的对话框的,
    我想知道怎样在主框架显示之"前"弹出系统登陆的对话框
    -------------------------------------------------------------楼主武断了吧 :) 在项目文件中可以写:  Application.CreateForm(TfrmMain, frmMain);
      Application.Initialize;
      with TfrmLogin.Create(Application) do
      begin
        ShowModal;
        if (UserName = ...) and (PassWord = ...) then
        begin
          Close ;
          Application.Run ;
        end
        else 
          Application.Terminate ; 
     end;真是在主框架显示之"后"弹出系统登陆的对话框的 ?