in reply to "background" perl processes on Win9X - how to avoid that "Perl - please close this application" on Windows Reboot/Logoff?

You could write a C wrapper that responds to the message CTRL_LOGOFF_EVENT if running in a console or WM_QUERYENDSESSION and WM_ENDSESSION if running as a Window. I don't know how to write a callback in perl, maybe POE?
  • Comment on Re: "background" perl processes on Win9X - how to avoid that "Perl - please close this application" on Windows Reboot/Logoff?

Replies are listed 'Best First'.
Re: Re: "background" perl processes on Win9X - how to avoid that "Perl - please close this application" on Windows Reboot/Logoff?
by Anonymous Monk on Apr 06, 2004 at 11:53 UTC
    In fact, I'm struggling with C wrapper now.. But it turns out that WM_QUERYENDSESSION is sent only to visible windows (only catching it on Win98+ allows to kill a child in time, without getting that "close application" dialog to appear); but I don't want any window to be visible (and an icon inside a tray is not acceptable either).. BTW, any hints how to make window to be visible from system POV, but invisible from user POV (e.g. offscreen windows or zero-sized windows?)
      From memory, the same messgae is sent to all windows on the system. You should beable to create an invisible window of 0x0 size using the CreateWindowEx API function. Your Perl App will need to add a message handler that responds to the appropriate messages.

      MSDN Article on Message Only Windows

      That doesn't sound right, I'm sure you can create an invisible window and still have it respond to WM_QUERYENDSESSION.

      Some Googling later...

      Message Only Windows

        And as for msg-only window, creating window with parent 0x84 on Win98 crashes the program (at least on the box I was testing it). May be it works for you due to some windows software updating your system .dlls (e.g. .NET framework, or office XP installation, or MSIE with latest security fixes).