Mega Code Archive

 
Categories / Delphi / System
 

How to detect a Windows Shutdown

Title: How to detect a Windows Shutdown type TForm1 = class(TForm) private procedure WMEndSession(var Msg: TWMEndSession); message WM_ENDSESSION; public end; implementation {$R *.DFM} procedure TForm1.WMEndSession(var Msg: TWMEndSession); begin if Msg.EndSession = True then ShowMessage('Windows is shutting down!'); inherited; end;