Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming! |
⤷ Confirmation on Windows exit
Use onCloseQuery event of main form. The OnCloseQuery event occurs when the Close method is called or when the user chooses Close from the form's System menu.So, you may ask confirmation and close form, if user click on Yes button.
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if MessageDlg(
'Are you sure?',
mtConfirmation,
[mbYes, mbNo],
0)=mrNo then
CanClose:=False
else
CanClose:=True;
end;
-
More for developers