For Newbie

Tuesday, 15 November 2011

Tricks MessageBox displays a message when the form on the close. This way when we give a close form, the message will be displayed.



Edit event on FormCloseQuery:
TForm1.FormCloseQuery procedure (Sender: TObject; var CanClose: Boolean);
begin
   if MessageBox (Handle, 'Get out of the application?', 'Confirmation',
                 MB_ICONQUESTION MB_YESNO +) = idYes then
     CanClose: = True
   else
     CanClose: = False;
end;

Share on Facebook
Share on Twitter
Share on Google+