Results 1 to 3 of 3

Thread: system Shutdown

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Posts
    14

    system Shutdown

    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

  2. #2
    Member
    Join Date
    Jan 2003
    Posts
    37
    You can use SystemEvents.SessionEnding, but I haven't figured out how you actually use it yet.. Have you?

  3. #3
    New Member
    Join Date
    Dec 2002
    Location
    Randolph, NJ
    Posts
    6
    Its very easy to use. You add an event handler just like any event

    VB Code:
    1. Sub main()
    2. addhandler Microsoft.Win32.SystemEvents.SessionEnding, addressof Shutdown
    3. End Sub
    4.  
    5. Sub Shutdown (sender as Object, e as Microsoft.Win32.SessionEndingEventArgs)
    6. 'add any shutdown code here
    7. Application.Exit()
    8. End Sub
    I FOUND YOU

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width