Closing Application When Reboot is requiered

H

Haim

Anybody knows how to prevent a shutdown command? (on Win
XP).
Or just a way to let my application close itself rather
then being killed by the restart command.
I have been working in my organization on an application
that sometimes gets killed by an installation that
restarts the computer. I want to prevent this from
happening and display my own message box that asks for
reboot - or as i said, simply give my application time to
close itself.
Is there any way, a windows flag, anything at all that
can prevent shutdown command, or anything I can do in my
application that would respond to such a thing?
I tried to use the AbortSystemShutdownA() API but it
simply does not help since I have no way of knowing when
the shutdown will be executed and it would be stupid to
execute the AbortSystemShutdownA() function every
milisecond or so...

Anybody ? ...

Thanks,

Haim.
 
S

Sean Hederman

You'll need to trap the WM_QUERYENDSESSION message in the main windows
message handler. You can return TRUE when you're ready to shutdown, or FALSE
to abort the shutdown.
 

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