Thread: Exit Windows problem

  1. #1
    Registered User cfrost's Avatar
    Join Date
    Apr 2004
    Posts
    119

    Cool Exit Windows problem

    I have used
    ExitWindows(EWX_LOGOFF|EWX_REBOOT,0);
    but it logs of and waits for logon
    I also tried
    EWX_REBOOT only and also with EWX_FORCE nothing happens same result what to do?

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    http://msdn.microsoft.com/library/de...xitwindows.asp

    msdn'ness!! ^^^

    anyways, here's what i saw there:


    ExitWindows

    The ExitWindows function logs off the current user. It sends the WM_QUERYENDSESSION message to determine if they can be terminated.

    To shut down the system, or shut down and restart the system, use the ExitWindowsEx function.



    note the italicized/bolded sentence...

  3. #3
    Registered User cfrost's Avatar
    Join Date
    Apr 2004
    Posts
    119
    I used ExitWindowsEx but i give me error for reasons macro it says it is not defined
    Please provide me the definations of macros(all)

  4. #4
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    are you linking the user32 lib? cause it just needs windows.h
    try something like this
    Code:
    ExitWindowsEx(
      EWX_REBOOT,
      SHTDN_REASON_MAJOR_APPLICATION
    );
    Woop?

  5. #5
    Registered User cfrost's Avatar
    Join Date
    Apr 2004
    Posts
    119
    I want Defination of SHTDN_REASON_MAJOR_APPLICATION macro
    i.e
    #define SHTDN_REASON_MAJOR_APPLICATION ????

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Like I said in one of your other threads, you can't just go round grabbing random declarations from other peoples header files (and/or libraries to match), and expect it all to work.

    If your OS/Compiler is too old, then either upgrade or find another way to achieve what you want.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Youve stated that you have VC++6.

    In that case download the Platform SDK from here...http://www.microsoft.com/msdownload/...sdk/sdkupdate/

    That will give you current headers and libs for all of the general APIS

  8. #8
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    The calling thread has to have the SE_SHUTDOWN_NAME privilege in order to shutdown or reboot.

    How to Shut Down the System

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows explorer problem.
    By stevesmithx in forum Tech Board
    Replies: 7
    Last Post: 05-14-2008, 06:10 AM
  2. Possible Windows MDAC problem
    By BobS0327 in forum Tech Board
    Replies: 3
    Last Post: 06-28-2006, 04:57 AM
  3. Odd memory leaks
    By VirtualAce in forum C++ Programming
    Replies: 11
    Last Post: 05-25-2006, 12:56 AM
  4. C++ Gurus, UNIX vs. Windows ascii problem perhaps?
    By puck in forum C++ Programming
    Replies: 6
    Last Post: 03-28-2003, 10:33 PM
  5. Windows 98 problem
    By Hannwaas in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 12-30-2001, 12:01 PM