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. Reset to computer

Reset to computer

Scheduled Pinned Locked Moved C / C++ / MFC
question
9 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.
  • R Offline
    R Offline
    RomTibi
    wrote on last edited by
    #1

    Can anybody tell me a function that resets the computer?

    36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

    D E G 3 Replies Last reply
    0
    • R RomTibi

      Can anybody tell me a function that resets the computer?

      36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

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

      Resets it to what?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "Man who follows car will be exhausted." - Confucius

      R 1 Reply Last reply
      0
      • R RomTibi

        Can anybody tell me a function that resets the computer?

        36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

        E Offline
        E Offline
        Eugen Podsypalnikov
        wrote on last edited by
        #3

        Try it :) : shutdown -r[^]

        virtual void BeHappy() = 0;

        R 1 Reply Last reply
        0
        • D David Crow

          Resets it to what?

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "Man who follows car will be exhausted." - Confucius

          R Offline
          R Offline
          RomTibi
          wrote on last edited by
          #4

          I mean to restart the computer, like pressing start -> Turn off computer -> Restart

          36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

          D 1 Reply Last reply
          0
          • R RomTibi

            I mean to restart the computer, like pressing start -> Turn off computer -> Restart

            36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

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

            Try ExitWindowsEx(EWX_REBOOT).

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "Man who follows car will be exhausted." - Confucius

            R 1 Reply Last reply
            0
            • R RomTibi

              Can anybody tell me a function that resets the computer?

              36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

              G Offline
              G Offline
              gamefreak2291
              wrote on last edited by
              #6

              As someone else already suggested, you can use the command "shutdown -r" which will run just as though you used it through command prompt. An example:

              void main()
              {
              system("shutdown -r");
              }

              This will default to a 30 second timer before the computer begins to shutdown. With some effort, you should be able to find a way to decrease the timer, although I'm not positive. EDIT: system("shutdown -r -t 10"); that will set the shutdown timer to 10 seconds, instead of the default 30. The command shutdown tells the computer what to do, "-r" is for resetting the computer, "-t xx" (-t 10) sets the time to the amount of seconds you indicate, so if your code were "system("shutdown -r -t 1");" The computer would start resetting one second after your program executes that line of code. Theoretically you can set it to 0 seconds, but I don't feel like testing that one ;P

              R 1 Reply Last reply
              0
              • D David Crow

                Try ExitWindowsEx(EWX_REBOOT).

                "One man's wage rise is another man's price increase." - Harold Wilson

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                "Man who follows car will be exhausted." - Confucius

                R Offline
                R Offline
                RomTibi
                wrote on last edited by
                #7

                Thank you!:rose:

                36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

                1 Reply Last reply
                0
                • E Eugen Podsypalnikov

                  Try it :) : shutdown -r[^]

                  virtual void BeHappy() = 0;

                  R Offline
                  R Offline
                  RomTibi
                  wrote on last edited by
                  #8

                  Thank you very much!:rose:

                  36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

                  1 Reply Last reply
                  0
                  • G gamefreak2291

                    As someone else already suggested, you can use the command "shutdown -r" which will run just as though you used it through command prompt. An example:

                    void main()
                    {
                    system("shutdown -r");
                    }

                    This will default to a 30 second timer before the computer begins to shutdown. With some effort, you should be able to find a way to decrease the timer, although I'm not positive. EDIT: system("shutdown -r -t 10"); that will set the shutdown timer to 10 seconds, instead of the default 30. The command shutdown tells the computer what to do, "-r" is for resetting the computer, "-t xx" (-t 10) sets the time to the amount of seconds you indicate, so if your code were "system("shutdown -r -t 1");" The computer would start resetting one second after your program executes that line of code. Theoretically you can set it to 0 seconds, but I don't feel like testing that one ;P

                    R Offline
                    R Offline
                    RomTibi
                    wrote on last edited by
                    #9

                    Thanks a lot!:rose:

                    36. When you surround an army, leave an outlet free. ... Do not press a desperate foe too hard. SUN-TZU - Art of War

                    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