Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, Can You tell me what signal Windows send at the user logoff? How may I trap it? Thanks in Advance.

Replies are listed 'Best First'.
Re: Windows Signals"
by esskar (Deacon) on Mar 04, 2004 at 22:42 UTC
    When a logoff event occurs, the system notifies all processes in the system as follows:

    All windows of processes in the logon session being logged off receive the WM_QUERYENDSESSION (0x0011) and WM_ENDSESSION (0x0016) messages. All windows on the desktops of the window station being logged off receive these messages, even if the windows belong to processes running in another logon session.
      For simple console apps, you can also call SetConsoleCtrlHandler() and the message sent for logoff is CTRL_LOGOFF_EVENT
        Thanks. How may I implement that in perl? Jes