: I want to create an application which will run an external application to sync the PC's "My Documents" folder with the server, when the user clicks Shutdown or LogOff. Does anyone have code demonstrating how to do this?
this will be a problem, because system (win XP) does not allow start application and libraries when system is shutting down..
I guess there's a big reason why you're not using native synchronization (that synchronizes files automatically on shutdown - if turned on)
There could be possible tho handle system messages and "catch" shutdown request, run your app, wait until it dies and send te request furher for other applications... But this will cause serious troubles and make your system even less stable..
Don't take life too seriously anyway you won't escape alive from it!