Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# shutdown event

C# shutdown event

Scheduled Pinned Locked Moved C#
questioncsharp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mabad
    wrote on last edited by
    #1

    I need to run a cleanup routine before system shutdown. How can I catch the system shutdown event in my C# application? Martin

    T 1 Reply Last reply
    0
    • M mabad

      I need to run a cleanup routine before system shutdown. How can I catch the system shutdown event in my C# application? Martin

      T Offline
      T Offline
      the last free name
      wrote on last edited by
      #2

      Look at the SystemEvents class.

      M 1 Reply Last reply
      0
      • T the last free name

        Look at the SystemEvents class.

        M Offline
        M Offline
        mabad
        wrote on last edited by
        #3

        I found another way to do it. protected override void WndProc(ref System.Windows.Forms.Message m) { // defined in winuser.h const int WM_QUERYENDSESSION = 0x0011; switch(m.Msg) { case WM_QUERYENDSESSION: ////////////////// // cleanup section // ////////////////// base.WndProc(ref m); break; default: base.WndProc(ref m); break; } } Thank you "the last free name" for your suggestion!:)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups