Re: Notification of WIndows Shutdown.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Fri, 4 Jan 2008 13:14:57 -0800, "Bob Butler" <noway@xxxxxxxxxxx>
wrote:

"Mike Williams" <mike@xxxxxxxxxxxxxxxxx> wrote in message
news:OyK53YxTIHA.4532@xxxxxxxxxxxxxxxxxxxxxxx
"PeterD" <peter2@xxxxxxxxxx> wrote in message
news:4o6tn3lfkgo2sl3je478hug3ka9a7aqsod@xxxxxxxxxx

Any easy VB6 way to trap a Windows shutdown? I tried the
unload functions for the form, but they don't reflect (or my test
didn't show it) that it was a Windows shutdown and not an
application derived shutdown.

Have you tried checking the UnloadMode parameter in the Form's QueryUnload
event? Here are the values:

0 The user chose the Close command from the Control menu on the form.
1 The Unload statement is invoked from code.
2 The current Microsoft Windows operating environment session is ending.
3 The Microsoft Windows Task Manager is closing the application.
4 An MDI child form is closing because the MDI form is closing.
5 A form is closing because its owner is closing.

I think the problem here is that #2 doesn't differentiate between Logoff and
Shutdown. I remember looking into this a long time ago and not finding any
solution to it.

I'm not sure I care if it does, but my application doesn't have a form
so trapping QueryUnload is not working as I want. I put in a dummy
form (loaded, but kept invisible) but the only notification it gets is
that it is 'invoked from code'.
.



Relevant Pages

  • Re: Notification of WIndows Shutdown.
    ... application derived shutdown. ... The Unload statement is invoked from code. ... The current Microsoft Windows operating environment session is ending. ... The Microsoft Windows Task Manager is closing the application. ...
    (microsoft.public.vb.general.discussion)
  • Re: Notification of WIndows Shutdown.
    ... The Unload statement is invoked from code. ... The current Microsoft Windows operating environment session is ending. ... The Microsoft Windows Task Manager is closing the application. ...
    (microsoft.public.vb.general.discussion)
  • Re: Notification of WIndows Shutdown.
    ... The Unload statement is invoked from code. ... The current Microsoft Windows operating environment session is ending. ... The Microsoft Windows Task Manager is closing the application. ...
    (microsoft.public.vb.general.discussion)
  • Re: Windows XP wont shutdown first time, but on the second time.
    ... As far as the shutdown sequence. ... Log Off and nothing will happen, WIndows will Idle. ... this means closing all applications and services, ... from the network, writing and updating the Registry, etc. ...
    (microsoft.public.windowsxp.general)
  • Re: Windows xp fast shutdown
    ... > Is there any way to have windows xp pro sp2 shutdown without closing all ... > nag window on the screen at shutdown and windows cannot close it without ...
    (microsoft.public.windowsxp.help_and_support)