网上看了一些资料,自己照着做怎么不行呢,麻烦大家帮我看看什么地方有错,谢谢你了procedure TForm4.BitBtn1Click(Sender: TObject);//密码输入后确认事件
 var
  PWFile: TextFile;
  Possword : string;
begin
  AssignFile(PWFile,'config.sys');//密码保存于config文件中
  Reset(PWFile);
  Readln(PWFile,Possword);
  CloseFile(PWFile);
  inc(entertime);
  if Edit1.Text=Possword then   //password
     begin
    form4.ModalResult:=mrok;//密码输入正确则返回值为"mrok"
     end
  else
  begin
    Label1.Caption:='密码输入错误,请重新输入:';
    if entertime>=3 then
    begin
      MessageBox(Handle,'输入密码错误超过三次,程序退出!','信息',MB_OK);
      Close;
      Application.Terminate;
    end else
    begin
      Edit1.Text:='';
      Edit1.SetFocus;
    end;
  end;
end;
procedure TForm4.FormCreate(Sender: TObject);
begin
   entertime:=0;
end;end.
dpr文件中的代码
begin
  Application.Initialize;  form4:= Tform4.Create(Application);
 if form4.ShowModal=mrok then//编译时提醒我"mrok"未定义
  begin
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.CreateForm(TForm3, Form3);
  form4.Free;
  Application.Run;
  end
  else
  begin
    form4.Free;
    Application.Terminate;
  end;