Order and save right now!
20% off with the dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming!
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