Results 1 to 3 of 3

Thread: Shutdown Windows...

  1. #1

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205

    Shutdown Windows...

    How can I initiate Windows Shutdown in C++??
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  2. #2
    Member
    Join Date
    Oct 2000
    Location
    Aiken, SC
    Posts
    36

    Hello

    Hey,

    I am just now going back to C++, I used it a long time ago for a multimedia presentation, but for the past few years have used VB for everything, I made a daemon (Ok it is realy a trojan). That would reboot a computer when you connected to port 20. (Good for when my little bro was kicking my butt in a strategy game.) And I used the following VB code. If you include winuser.h, you should be able to call the ExitWindowsEx function. You may have to do something else with NT / 2000 I don't know. Anyways, the following VB code was copied from. vb world.

    http://www.vb-world.net/tips/tip12.html

    Public Const EWX_LOGOFF = 0
    Public Const EWX_SHUTDOWN = 1
    Public Const EWX_REBOOT = 2
    Public Const EWX_FORCE = 4
    Declare Function ExitWindowsEx Lib "user32" Alias _
    "ExitWindowsEx" (ByVal uFlags As Long, ByVal dwReserved _
    As Long) As Long
    If you wanted to forcefully reboot the computer use the following code:

    t& = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)

    I hope that helps some,

    Joey
    You have no idea how many idiots there are among us.

    Winsock is awesome!
    If you are reading this, your a geek, just face it.

  3. #3

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Cheers, dude. My prob was not knowing which lib to include.
    Ta.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width