Hola BPL.
Como no se requiere intervención del usuario, creo que capturar el mensaje
WM_ENDSESSION te va a funcionar:
Código Delphi
[-]
type
TForm1 = class(TForm)
private
procedure WMEndSession(var Msg: TWMEndSession); message WM_ENDSESSION;
...
implementation
procedure TForm1.WMEndSession(var Msg: TWMEndSession);
begin
if Msg.EndSession then
begin
ShowMessage('Windows se cerrará'); end;
end;
Saludos.