Re: Notification of WIndows Shutdown.
- From: "Steve Gerrard" <mynamehere@xxxxxxxxxxx>
- Date: Sun, 6 Jan 2008 10:33:28 -0800
Bob Butler wrote:
PeterD wrote:
On Sat, 5 Jan 2008 20:35:54 -0800, "Steve Gerrard"<cut>
<mynamehere@xxxxxxxxxxx> wrote:
Small for loop, with an embedded sleep. It sleeps for about 3
minutes, then wakes up and checks the 'other' application. If the
other application is done (checks a registry entry) then it does its
thing and closes.
If you are coming out of a Sleep API call and then immediately
checking the registry and exiting then it's possible that the
queryunload message is waiting but you're quitting before it gets
processed. You might try using a DoEvents after the sleep completes
to let any pending messages be handled first.
You could also try re-architecting so that instead of a Sleep call you
use a form with a timer and do your checks when the timer fires. That
would let you be more responsive to the shutdown requests.
I think Bob is spot on here. Your app does not shut down because the form gets
closed; it shuts down when the loop determines that the other app has shut down
(or needs help).
When a user logs off, the sequence will be:
1. Other app gets the shutdown request and closes. 2. Your app comes out of
sleep, sees that the other app is closed, and shuts down. 3. When your exit code
unloads the form, it says it was unloaded by code.
I don't think your form is doing any events. When you close it from your main
loop, that will call the queryunload handler directly, but the form is not
getting anything from its message pump. As Bob said, a DoEvents at the end of
every Sleep, or using a Timer event on a form instead, will change that.
.
- References:
- Notification of WIndows Shutdown.
- From: PeterD
- Re: Notification of WIndows Shutdown.
- From: Mike Williams
- Re: Notification of WIndows Shutdown.
- From: PeterD
- Re: Notification of WIndows Shutdown.
- From: Steve Gerrard
- Re: Notification of WIndows Shutdown.
- From: PeterD
- Re: Notification of WIndows Shutdown.
- From: Steve Gerrard
- Re: Notification of WIndows Shutdown.
- From: PeterD
- Re: Notification of WIndows Shutdown.
- From: Bob Butler
- Notification of WIndows Shutdown.
- Prev by Date: Re: Still BitBlit/ GDI question...
- Next by Date: Re: I cannot stop LV flickering when form resizing
- Previous by thread: Re: Notification of WIndows Shutdown.
- Next by thread: Re: Notification of WIndows Shutdown.
- Index(es):
Relevant Pages
|