我的办法用简单的两个Edit时可以通过,两过程代码如下。
procedure TForm1.Edit1Exit(Sender: TObject);
begin
if Bln = True then
Exit
else
ShowMessage('Bad Method!');
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Bln := True;
if MessageBox(Application.Handle,'Really Exit?',
'OnClose',mb_YesNo+mb_IconQuestion) = mryes then
begin
Action := caHide;
Application.Terminate;
end
else
Action := caNone;
Exit;
end;