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. System Restart

System Restart

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 3 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.
  • K Offline
    K Offline
    Kiran Pinjala
    wrote on last edited by
    #1

    Can we restart the system programatically? Can you show me tha way? Thank you.

    Saadhinchaali

    L H 2 Replies Last reply
    0
    • K Kiran Pinjala

      Can we restart the system programatically? Can you show me tha way? Thank you.

      Saadhinchaali

      L Offline
      L Offline
      Lim Bio Liong
      wrote on last edited by
      #2

      The following is from MSDN : BOOL WINAPI InitiateSystemShutdown( __in_opt LPTSTR lpMachineName, __in_opt LPTSTR lpMessage, __in DWORD dwTimeout, __in BOOL bForceAppsClosed, __in BOOL bRebootAfterShutdown ); Initiates a shutdown and optional restart of the specified computer. To record a reason for the shutdown in the event log, call the InitiateSystemShutdownEx function. However, note the following : To shut down the local computer, the calling thread must have the SE_SHUTDOWN_NAME privilege. To tweak privileges, use OpenProcessToken(), LookupPrivilegeValue(), AdjustTokenPrivileges(). Best of luck, Bio.

      1 Reply Last reply
      0
      • K Kiran Pinjala

        Can we restart the system programatically? Can you show me tha way? Thank you.

        Saadhinchaali

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        See ExitWindowsEx.

        K 1 Reply Last reply
        0
        • H Hamid Taebi

          See ExitWindowsEx.

          K Offline
          K Offline
          Kiran Pinjala
          wrote on last edited by
          #4

          Thank you so much guys.

          Saadhinchaali

          H 1 Reply Last reply
          0
          • K Kiran Pinjala

            Thank you so much guys.

            Saadhinchaali

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            You're welcome. ;)

            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