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

Hi Monks,

I need in my script (a daemon) to trap logoff and shtdown events by listing WM_QUERYENDSESSION and WM_ENDSESSION messages.
My ask is how may I do that?

Thanks in Advance.

Eustaquio

Replies are listed 'Best First'.
Re: How to trap logoff
by PodMaster (Abbot) on Mar 16, 2004 at 19:30 UTC
    You'd use Win32::GUI's Hook method and provide a callback (or maybe even use Win32::API to wrap your own hook), or you'd use Wx and provide a wxApp::OnQueryEndSession/wxApp::OnEndSession.

    If you're using Win32::DAEMON, you should use RegisterCallbacks ...

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: How to trap logoff
by Limbic~Region (Chancellor) on Mar 16, 2004 at 19:11 UTC
    Anonymous Monk,
    This looks exactly like another post. If the suggestions there are of no help, could you explain more about why you need this functionality? I am guessing you want to have your daemon "shutdown" properly. Seeing a bit of the daemon or a sample script or why you need to handle "shutdowns" might go a long way in getting help.

    Cheers - L~R