> 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
Ben Voigt - 17 Jan 2007 15:32 GMT
> 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/prodtechnol/windows2000serv/reskit/regentry/346
37.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/prodtechnol/windows2000serv/reskit/regentry/346
37.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
Frank - 17 Jan 2007 16:46 GMT
>> One solution is to respond immediately to the WM_QUERYENDSESSION by
>> returning FALSE (abort shutdown), and then initiate the same kind of
[quoted text clipped - 4 lines]
> 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
[quoted text clipped - 12 lines]
>>
>> Tom
Frank - 17 Jan 2007 16:44 GMT
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
>> My program gets a WM_QUERYENDSESSION message and asks the user if it is
>> OK to shutdown.
[quoted text clipped - 30 lines]
>
> Tom