By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,666 Members | 1,784 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,666 IT Pros & Developers. It's quick & easy.

Can I delay windows automatically shuting down my app?

P: n/a
My program gets a WM_QUERYENDSESSION message and asks the user if it is OK
to shutdown.

While he's thinking about it, Windows displays a box saying the program is
not responding, and if not answered shuts down my program.

I need to delay that while until the user answers my program's dialog box.

How does Windows check to see if an app is responding.

Can I either make windows satisfied that my program is responding
or specify a longer time before it displays its box
or increase the time its box is displayed before it automatically shuts down
my app?

Thanks for any help

Jan 16 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Frank wrote:
My program gets a WM_QUERYENDSESSION message and asks the user if it is OK
to shutdown.

While he's thinking about it, Windows displays a box saying the program is
not responding, and if not answered shuts down my program.
Responding usually means processing messages.
I need to delay that while until the user answers my program's dialog box.

How does Windows check to see if an app is responding.
I think it fires messages to the window and waits for a response. No
response within a reasonable period == not responding. In this case, the
message is WM_QUERYENDSESSION, and that's a problem for you I think,
since the whole point is that you need to delay responding to that
message until later.
Can I either make windows satisfied that my program is responding
or specify a longer time before it displays its box
or increase the time its box is displayed before it automatically shuts down
my app?
One solution is to respond immediately to the WM_QUERYENDSESSION by
returning FALSE (abort shutdown), and then initiate the same kind of
shutdown that had already been initiated once the user has responded to
your message (actually, I'm not sure whether you can work out whether it
was a restart or a plain shutdown).

I don't know of a way to change the OS delay you mention - there may be
a registry key somewhere for it.

Tom
Jan 17 '07 #2

P: n/a
One solution is to respond immediately to the WM_QUERYENDSESSION by
returning FALSE (abort shutdown), and then initiate the same kind of
shutdown that had already been initiated once the user has responded to
your message (actually, I'm not sure whether you can work out whether it
was a restart or a plain shutdown).
Users *hate* that behavior, they expect that if they click logout and walk
away, the computer will be logged off when they come back.

Find some reasonable default behavior, like saving all open files with an
alternate name (append .autosave or .leftopen to the filename). Then, if
the user hasn't responded to your prompt by the timeout, execute the default
behavior and quit.

http://www.microsoft.com/technet/pro....mspx?mfr=true

Note that if AutoEndTasks is set you need to give up on waiting for the user
with time to spare for your own processing or I/O, otherwise your app will
be rudely terminated.
http://www.microsoft.com/technet/pro....mspx?mfr=true
>
I don't know of a way to change the OS delay you mention - there may be a
registry key somewhere for it.

Tom

Jan 17 '07 #3

P: n/a
Seems to me that this should be a common problem.
Many programs ask if you want to save before shutdown
I think, haven't really seen it lately

Thanks
"Tom Widmer [VC++ MVP]" <to********@hotmail.comwrote in message
news:eI**************@TK2MSFTNGP06.phx.gbl...
Frank wrote:
>My program gets a WM_QUERYENDSESSION message and asks the user if it is
OK to shutdown.

While he's thinking about it, Windows displays a box saying the program
is not responding, and if not answered shuts down my program.

Responding usually means processing messages.
>I need to delay that while until the user answers my program's dialog
box.

How does Windows check to see if an app is responding.

I think it fires messages to the window and waits for a response. No
response within a reasonable period == not responding. In this case, the
message is WM_QUERYENDSESSION, and that's a problem for you I think, since
the whole point is that you need to delay responding to that message until
later.
>Can I either make windows satisfied that my program is responding
or specify a longer time before it displays its box
or increase the time its box is displayed before it automatically shuts
down my app?

One solution is to respond immediately to the WM_QUERYENDSESSION by
returning FALSE (abort shutdown), and then initiate the same kind of
shutdown that had already been initiated once the user has responded to
your message (actually, I'm not sure whether you can work out whether it
was a restart or a plain shutdown).

I don't know of a way to change the OS delay you mention - there may be a
registry key somewhere for it.

Tom

Jan 17 '07 #4

P: n/a

"Ben Voigt" <rb*@nospam.nospamwrote in message
news:eZ**************@TK2MSFTNGP02.phx.gbl...
>
>One solution is to respond immediately to the WM_QUERYENDSESSION by
returning FALSE (abort shutdown), and then initiate the same kind of
shutdown that had already been initiated once the user has responded to
your message (actually, I'm not sure whether you can work out whether it
was a restart or a plain shutdown).

Users *hate* that behavior, they expect that if they click logout and walk
away, the computer will be logged off when they come back.
I hadn't thought about that.
I'll look at the sites.

thanks

>
Find some reasonable default behavior, like saving all open files with an
alternate name (append .autosave or .leftopen to the filename). Then, if
the user hasn't responded to your prompt by the timeout, execute the
default behavior and quit.

http://www.microsoft.com/technet/pro....mspx?mfr=true

Note that if AutoEndTasks is set you need to give up on waiting for the
user with time to spare for your own processing or I/O, otherwise your app
will be rudely terminated.
http://www.microsoft.com/technet/pro....mspx?mfr=true
>>
I don't know of a way to change the OS delay you mention - there may be a
registry key somewhere for it.

Tom


Jan 17 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.