Thread: Problems with ExitWindowsEx

  1. #1
    Banned Yuri's Avatar
    Join Date
    Aug 2005
    Location
    Breukelen, The Netherlands
    Posts
    133

    Problems with ExitWindowsEx

    Hi.
    I am trying to shut down my comp. (or turn off power) with if but I fail. Log off does work, to bad Power off doesn't . So can anyone help me with this problem?
    Code:
    This DOES work:
    
        if ( Attempts <= 1 ){
        ExitWindowsEx(EWX_LOGOFF,0);
        } 
    
    This DOESN'T work:
    
        if ( Attempts <= 1 ){
        ExitWindowsEx(EWX_POWEROFF,0);
        }
    Off Topic: Sorry for the first post but why can't I post on a old thread?

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    >>> why can't I post on a old thread?

    You did read the rules before posting didn't you? Let me help, Rule 5...
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Banned Yuri's Avatar
    Join Date
    Aug 2005
    Location
    Breukelen, The Netherlands
    Posts
    133
    Ow ok, I am sorry now I know the rules but I still don't know my problem. Just need to wait some longer, thanks anyway.

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    As mentioned in the other thread, you need to enable the SE_SHUTDOWN_NAME privilege. You can do this with my EnableProcessPrivilege function:
    Code:
    EnableProcessPrivilege(SE_SHUTDOWN_NAME, TRUE);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. C Pointers Problems
    By mhelal in forum C Programming
    Replies: 8
    Last Post: 01-10-2007, 06:35 AM
  3. Rendering problems (DirectX?)
    By OnionKnight in forum Tech Board
    Replies: 0
    Last Post: 08-17-2006, 12:17 PM
  4. contest problems on my site
    By DavidP in forum Contests Board
    Replies: 4
    Last Post: 01-10-2004, 09:19 PM
  5. DJGPP problems
    By stormswift in forum C Programming
    Replies: 2
    Last Post: 02-26-2002, 04:35 PM