in reply to Re: SetConsoleCtrlHandler Script
in thread SetConsoleCtrlHandler Script

So,

What can I do that?

Thanks.

Jes

Replies are listed 'Best First'.
Re: Re: Re: SetConsoleCtrlHandler Script
by BrowserUk (Patriarch) on Mar 08, 2004 at 21:15 UTC

    You could take a look at Win32::API::Callback. This is a part of dada's Win32-API-0.41 package. The documentation is minimalist, the best examples are in the samples directory.

    I have no idea whether this would work is conjunction with SetConsoleCtrlHandler, but it's possible. I think that you may well be the first to try to do this, which means you will be on your own for the most part.

    The alternative is to write your own callback wrapper in C or XS. You will need a compiler compatible with the build of Perl you are using. Again, you will be very much on your own getting this to work.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
      First, Thanks for help.

      My need is trap logoff and shutdown events in my daemon application.
      I'm not sure the SetConsoleCtrlHandler is the best way.
      What is the way with the same results?

      Jes

        I strongly suggest that you take a look at Win32:Deamon by Dada or perhaps even easier win32::Daemon::Simple by Jenda. They have already done all the hard work of interfacing between the OS and perl for setting up Win32 services.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail