Title: Detecting to final of Windows
Question: how to Detect the end of Windows?
Answer:
To detect to final of Windows, the message WM_ENDSESSION should be captured. These steps should be taken:
To declare a routine of manipulation of messages in the session private of the form:
procedure WMEndSession(var Msg : TWMEndSession); message WM_ENDSESSION;
To add the procedure to the section implementation of the unit:
procedure TForm1.WMEndSession(var Msg : TWMEndSession);
begin
if Msg.EndSession = TRUE then
ShowMessage(O Windows est finalizando + #13 + s + FormatDateTime(c, Now));
inherited;
end;