I have a problem. My program close everytime when I hit no in the following code:
procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
var
Antwort, BoxStyle : integer;
begin
BoxStyle:=MB_ICONQUESTION + MB_YESNO;
Antwort:=Application.MessageBox('Willst du das Programm wirklich beenden?', 'Programm Beenden?', BoxStyle);
// if Antwort = IDYES then
// begin
// Application.MessageBox('Ja', 'Antwort',MB_ICONINFORMATION)
// end
// else
// begin
// Application.MessageBox('Nein', 'Antwort', MB_ICONHAND);
// end;
// Form1.Enabled:=false;
if (Antwort = IDYES) and (B1.Visible = false) then
begin
Application.Terminate;
end
else if (Antwort = IDYES) and (B1.Visible = true) then
begin
BeendenKA;
end
else
begin
//Application.MessageBox('Super!', 'Antwort', MB_ICONINFORMATION);
end;
end;
Does anyone know how I can fix that? I think that it's an easy way to solve but i'm a bit new in pascal programming.