daemon app in win32

Dave LeBlanc whisper at oz.net
Mon Mar 26 13:41:18 EST 2001


AFAIK, Every Windows app gets sent a WM message when it's about to be
terminated. Most apps just let this fall through to the default
message processor (which you have to do anyway) without doiing
anything to clean up. You can add a message handler for this such that
the app can gracefully (make out it's will?) prepare to end it all.
Just make sure that in the end, it passes the message on to the
default message handler so that windows can do it's own cleanup of
your app.

Regards,

Dave LeBlanc

On Mon, 26 Mar 2001 19:02:27 +0200, Michael Bauer <Mike_B at T-Online.de>
wrote:

>Steve Purcell wrote:
>
>> Michael Bauer wrote:
>>> i am writing a daemon application that runs both under windows and unix.
>>> Since i am not very experienced in win32 - programming, i really would
>>> appreciate some hints how to register my app in win32 that i can do some
>>> cleanup-functions when windows is shut down.
>>> 
>>> At the moment it is just a standard console application that simply gets
>>> killed when windows shuts down. The app does not have/need a GUI, it
>>> should just run in the background.
>> 
>> 
>> If you're using NT, take a look at the win32service API. I think it
>> provides hooks like SvcStop that Windows will call for you (if you ask it
>> nicely).
>
>Hmm, seems like this is only available under NT. Is there a more general 
>way to accomplish this task independently of the underlying Windows-version?
>
>But maybe i should just get a life and write different wrappers for Win95, 
>Win98, WinME, Win200, WinNT... :-(
> 
>still hoping... Mike




More information about the Python-list mailing list