Run application before shutdown

K

krzysiek kubeczka

Hi all,

I would like to run an application after user chooses Turn Off
Computer from Menu Start and before Windows XP really starts to quit
everything and shut down.

Further more I need to know how to from my application really continue
with shutdown or abort and dispose the "Turn off" dialog box.

Which command is performed when "Turn off" button is selected? How to
exchange this command with my application?

Thanks for any help,
 
N

Newbie Coder

Czesc Chris,

Basically you need to trap a few things

When the user logs-off or shuts down it uses ExitWindowsEx API function using
the SE_SHUTDOWN_PRIVILEGE token. You need to use WndProc to trap the Windows
Message (WM_QUERYENDSESSION), revoke the shutdown privilege, run your
application & wait for application exit then allow the shutdown privilege again
using then use ExitWindowsEx API again to continue shutdown

Bardzo latwy jest - na prawde

Czy masz GG?

Na razie,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top