Click to See Complete Forum and Search --> : system Shutdown
vlitim
Aug 13th, 2002, 04:06 AM
How can I tell if the system is being shutdown/restarted as at the moment my program blocks any kind of shutdown/restart unless you close it manually, so I need to tell it to close when this event occurs
Cheers
Tim
Neofree
Feb 28th, 2003, 03:00 PM
You can use SystemEvents.SessionEnding, but I haven't figured out how you actually use it yet.. Have you?
DSAINMON
Feb 28th, 2003, 10:53 PM
Its very easy to use. You add an event handler just like any event
Sub main()
addhandler Microsoft.Win32.SystemEvents.SessionEnding, addressof Shutdown
End Sub
Sub Shutdown (sender as Object, e as Microsoft.Win32.SessionEndingEventArgs)
'add any shutdown code here
Application.Exit()
End Sub
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.