Detecting windows shutdown in an app 
Author Message
 Detecting windows shutdown in an app

I have an application that needs to shutdown a TAPI service before being
terminated by windows or else a page fault error occurs. For example, I have an
app running and a user decides to shutdown windows without closing the app first.
Does Windows send a message to an application before shutting down to see if its
ok to terminate the app, which allows the app time to do whatever it needs to do
before being terminated? If so does anyone have some sample code on how this is
done.

Thanks,
Drew



Sun, 29 Jun 2003 00:01:40 GMT  
 Detecting windows shutdown in an app
Why can't you just use your main form's QueryUnload event?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

I have an application that needs to shutdown a TAPI service before being
terminated by windows or else a page fault error occurs. For example, I have
an
app running and a user decides to shutdown windows without closing the app
first.
Does Windows send a message to an application before shutting down to see if
its
ok to terminate the app, which allows the app time to do whatever it needs
to do
before being terminated? If so does anyone have some sample code on how this
is
done.

Thanks,
Drew



Sun, 29 Jun 2003 01:31:50 GMT  
 Detecting windows shutdown in an app
As JW stated, you can use the Unloadmode variable in QueryUnload to detect
how an app is shutting down...

vbAppWindows      2  The current Microsoft Windows operating environment
session is ending.
vbAppTaskManager  3  The Microsoft Windows Task Manager is closing the
application.

So....

'===========
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
   'vbAppWindows = 2       The current Microsoft Windows operating
   '                       environment session is ending.
   'vbAppTaskManager = 3   The Microsoft Windows Task Manager is closing
   '                       the application.
   If UnloadMode = vbAppWindows Then
      MsgBox "Windows is shutting down"
   End If
   If UnloadMode = vbAppTaskManager Then
      MsgBox "Task Manager is shutting this program down"
   End If
End Sub
'===========


I have an application that needs to shutdown a TAPI service before being
terminated by windows or else a page fault error occurs. For example, I have
an
app running and a user decides to shutdown windows without closing the app
first.
Does Windows send a message to an application before shutting down to see if
its
ok to terminate the app, which allows the app time to do whatever it needs
to do
before being terminated? If so does anyone have some sample code on how this
is
done.

Thanks,
Drew



Sun, 29 Jun 2003 01:27:53 GMT  
 Detecting windows shutdown in an app


Quote:
> I have an application that needs to shutdown a TAPI service before
being =

> terminated by windows or else a page fault error occurs. For example,
I =
> have an=20
> app running and a user decides to shutdown windows without closing
the =
> app first.=20
> Does Windows send a message to an application before shutting down to
=
> see if its=20
> ok to terminate the app, which allows the app time to do whatever it =
> needs to do=20
> before being terminated? If so does anyone have some sample code on
how =
> this is=20
> done.

Windows sends a WM_QUERYENDSESSION, so subclass your startup form to
catch it. Have a look at sites such as http://www.searchvb.com for
samples.
--
Roger Abbott, RHA (Minisystems) Ltd - http://www.rhaminisys.com
DDE Client and Server ActiveX controls for Visual Basic
DDE FAQ and DDE utility tools, browser URL monitor,
Program launcher/setup menu, other freeware and shareware

Sent via Deja.com
http://www.deja.com/



Sun, 29 Jun 2003 17:03:12 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Can I detect Windows ShutDown in VB app? Thank you.

2. Detecting if app is shutdown by system or user

3. Detect if app shutdown by system or user

4. Detecting a Windows Shutdown

5. Detecting Windows shutdown

6. Detect Windows shutdown

7. How to detect Windows shutdown?

8. How can I detect Windows Shutdown????

9. Detecting Windows shutdown

10. Windows shutdown App?

11. Windows Shutdown from VB App?

12. VB3 apps and Windows shutdown

 

 
Powered by phpBB® Forum Software