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 / C++ / MFC
  4. How to block a user shutdown or logoff?

How to block a user shutdown or logoff?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
4 Posts 4 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.
  • S Offline
    S Offline
    ShaluMalu
    wrote on last edited by
    #1

    Hello everybody! I would like to know if there is any way to block a user from shutting down or logging off the system. Or atleast postpone the shutdown process for a particluar time interval. Is it possible to do that? I humbly request to respond me! Thanks in advance! regards, Shalini

    P N T 3 Replies Last reply
    0
    • S ShaluMalu

      Hello everybody! I would like to know if there is any way to block a user from shutting down or logging off the system. Or atleast postpone the shutdown process for a particluar time interval. Is it possible to do that? I humbly request to respond me! Thanks in advance! regards, Shalini

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #2

      Handle WM_QUERYENDSESSION message is your application. return FALSE to stop the shutdown of logoff process.

      if (message == WM_QUERYENDSESSION)
      {
      if(allow)
      {
      return TRUE;
      }
      else
      {
      return FALSE;
      }
      }

      Prasad Notifier using ATL | Operator new[],delete[][^]

      1 Reply Last reply
      0
      • S ShaluMalu

        Hello everybody! I would like to know if there is any way to block a user from shutting down or logging off the system. Or atleast postpone the shutdown process for a particluar time interval. Is it possible to do that? I humbly request to respond me! Thanks in advance! regards, Shalini

        N Offline
        N Offline
        Naveen
        wrote on last edited by
        #3

        overide the WM_QUERYENDSESSION message and return 0. And after you have done your time interval call ExitWindows() to shutdown.

        nave

        1 Reply Last reply
        0
        • S ShaluMalu

          Hello everybody! I would like to know if there is any way to block a user from shutting down or logging off the system. Or atleast postpone the shutdown process for a particluar time interval. Is it possible to do that? I humbly request to respond me! Thanks in advance! regards, Shalini

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          Handle WM_QUERYENDSESSION and return false from there.. then shutdown the window using InitiateSystemShutdown api

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

          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