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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to execute an command during shut down or restart

how to execute an command during shut down or restart

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
2 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.
  • A Offline
    A Offline
    ask_you
    wrote on last edited by
    #1

    i have developed and application where i handle the WM_ENDSESSION ON_MESSAGE(WM_ENDSESSION,OnMyEndSession) LRESULT CMyDlg::OnMyEndSession(WPARAM wParam, LPARAM lParam) { ShellExecute ( NULL, "open", "C:\\abc.exe, NULL, NULL, SW_HIDE ) ; } But the executable(abc.exe) is not executed.

    D 1 Reply Last reply
    0
    • A ask_you

      i have developed and application where i handle the WM_ENDSESSION ON_MESSAGE(WM_ENDSESSION,OnMyEndSession) LRESULT CMyDlg::OnMyEndSession(WPARAM wParam, LPARAM lParam) { ShellExecute ( NULL, "open", "C:\\abc.exe, NULL, NULL, SW_HIDE ) ; } But the executable(abc.exe) is not executed.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      What does OnMyEndSession() return? What is the value of wParam? You should probably handle the WM_QUERYENDSESSION message instead. This message is sent first, and if all applications respond with TRUE, Windows is going to shut down/restart. It wouldn't make sense to start up another application at this point since it would have not had a chance to respond to the WM_QUERYENDSESSION message.


      "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

      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