在主窗体运行前弹出一个登陆窗口,通过密码验证的则弹出主窗体,否则则退出程序???这段代码怎样写呀????

解决方案 »

  1.   

    先写一个登陆窗体(Login),在窗体的Create事件中,先Create登陆窗体,在登陆窗体中通过检验密码,
    如果密码正确则free掉登陆窗体,否则,终止应用程序。
      

  2.   

    http://community.csdn.net/Expert/topic/3269/3269253.xml?temp=.2465326
      

  3.   

    CSDN上有大把这样的贴了 麻烦提问前请先查阅一下
      

  4.   


    俺给你一个让你分析,你体会到了,也就学懂验证了!俺也是菜鸟!
     begin
     adoquery1.Close;
       try   adoquery1.SQL.Add('select * from users where [name]='+''''+name+''''+' and [password]='+''''+password+'''');   adoquery1.Open;
       
       if adoquery1.RecordCount> 0 then    begin
         result:=true;
         form1.Label1.Caption:='服务器端正在工作!';
        end
        else
         begin
         result:=false;
         form1.Label1.Caption:='服务器登陆失败!';
         end;
         except
         end;
     end;
      

  5.   

    program xxx.....begin
      Application.Initialize;        
      UserLog := TUserLog.Create(Application);//创建登陆窗体(在些窗体中判断密码是否正确)  
      if UserLog.ShowModal = mrOK then
      begin
        UserLog.Free ;
        Application.CreateForm(TMain, Main);
        Application.Run;
      end else
      begin
        Application.Terminate;
      end;以上不知是否理解???