Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TForm1.WMQueryEndSession(var Message: TWMQueryEndSession);
- begin
- inherited; { let the inherited message handler respond first }
- {--------------------------------------------------------------------}
- { at this point, you can either prevent windows from closing... }
- { Message.Result:=0; }
- {---------------------------or---------------------------------------}
- { just call the same cleanup procedure that you call in FormClose... }
- MyCleanUpProcedure;
- {--------------------------------------------------------------------}
- end;
- procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- MyCleanUpProcedure;
- end;
- procedure TForm1.WMQueryEndSession(var Message: TWMQueryEndSession);
- begin
- MyCleanUpProcedure;
- inherited;
- end;
- procedure TForm1.WMQueryEndSession(var Message: TWMQueryEndSession);
- begin
- MyCleanUpProcedure;
- Message.Result:=1; // tell Windows it is OK to shut down
- end;
- procedure TForm1.WMQueryEndSession(var Message: TWMQueryEndSession);
- begin
- MyCleanUpProcedure;
- Message.Result:=1; {Signal that it is OK to shut down}
- inherited; { let the inherited message handler respond }
- end;
Add Comment
Please, Sign In to add comment