Thread: ExitWindowsEx()

  1. #1
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052

    ExitWindowsEx()

    Hi, when I call this function like this:
    Code:
    ExitWindowsEx(EWX_FORCE, 0);
    on windows xp it only goes back to the logon screen. How do I make it completely shut down the computer?

    Thanks

  2. #2
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    this suggests that maybe the call should look like

    Code:
    ExitWindowsEx (EWX_FORCE | EWX_SHUTDOWN, 0);
    although they suggest strongly you feed a reason instead of using 0 for the second param
    hello, internet!

  3. #3
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    lol thanks. maybe i should start reading more about the stuff

  4. #4
    Registered User
    Join Date
    Sep 2002
    Posts
    88
    hey moi, what are those in your signature ??

    "GM/GMU d- s+:-- a--- C++ UL>+ P-- L+>++ !E W+ N-- o+ K- w++>+++ O---- M-- V? PS++ PE+++ Y PGP->-- t+ 5 X+ !R tv-- b DI+ D+++>+++++ G e->++++ h! r-> y--"

  5. #5
    ChrisNixon
    Guest
    No, fraid it's more complex than this. In XP you need (as the Remarks section in the MSDN article indicates) the correct level of priviledge. It's pretty complex, I spent most of a day researching MSDN and writing a chunk of code just to shut down XP. It ended up being a pageful which I'm definitely going to stick in a LIB sometime when I can be bothered!

    I can email it if you wish, I don't think it will be readable if I post it here.

    My email is [email protected] if you want to ask for a copy...dunno if the moderator lets us post email addresses!!

    Cheers,
    Chris.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems with ExitWindowsEx
    By Yuri in forum C++ Programming
    Replies: 3
    Last Post: 08-05-2005, 05:45 PM
  2. How to shutdown (or Restart) a pc with C++
    By Unregistered in forum C++ Programming
    Replies: 27
    Last Post: 08-05-2005, 12:59 PM
  3. force shutting down, power off win98
    By hanhao in forum Windows Programming
    Replies: 2
    Last Post: 03-20-2004, 06:43 AM
  4. ExitWindowsEx
    By SAMSAM in forum Windows Programming
    Replies: 0
    Last Post: 02-21-2003, 08:38 PM
  5. Information: Exiting Windows
    By Okiesmokie in forum C++ Programming
    Replies: 2
    Last Post: 05-12-2002, 09:42 AM