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 shut down the PC programatically.

how to shut down the PC programatically.

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

    I am using Smart device application & MFC option in VS2005 I want to shut down the PC programatically. how to do that?

    thanks

    _ M 2 Replies Last reply
    0
    • S saksp

      I am using Smart device application & MFC option in VS2005 I want to shut down the PC programatically. how to do that?

      thanks

      M Offline
      M Offline
      Madhu Nair 0
      wrote on last edited by
      #2

      saksp wrote:

      shut down the PC programatically

      ExitWindowsEx[^] or InitiateSystemShutdown[^]

      _ S 2 Replies Last reply
      0
      • S saksp

        I am using Smart device application & MFC option in VS2005 I want to shut down the PC programatically. how to do that?

        thanks

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        Use InitiateSystemShutdown[^]

        «_Superman_» I love work. It gives me something to do between weekends.

        1 Reply Last reply
        0
        • M Madhu Nair 0

          saksp wrote:

          shut down the PC programatically

          ExitWindowsEx[^] or InitiateSystemShutdown[^]

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          You just beat me to it. :)

          «_Superman_» I love work. It gives me something to do between weekends.

          M 1 Reply Last reply
          0
          • _ _Superman_

            You just beat me to it. :)

            «_Superman_» I love work. It gives me something to do between weekends.

            M Offline
            M Offline
            Madhu Nair 0
            wrote on last edited by
            #5

            «_Superman_» wrote:

            You just beat me to it.

            I had two RedBulls for lunch :-D

            1 Reply Last reply
            0
            • M Madhu Nair 0

              saksp wrote:

              shut down the PC programatically

              ExitWindowsEx[^] or InitiateSystemShutdown[^]

              S Offline
              S Offline
              saksp
              wrote on last edited by
              #6

              I tried both the functions but they are not working for Smart device application.

              thanks

              M 1 Reply Last reply
              0
              • S saksp

                I tried both the functions but they are not working for Smart device application.

                thanks

                M Offline
                M Offline
                Madhu Nair 0
                wrote on last edited by
                #7

                saksp wrote:

                they are not working for Smart device application

                Try this piece of code; MSDN Link[^]

                keybd_event(VK_OFF,0,KEYEVENTF_SILENT,0);
                keybd_event(VK_OFF,0,KEYEVENTF_SILENT | KEYEVENTF_KEYUP,0);
                sleep(60);

                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