>My computer has power management built-in. So the hardware
>is definitely NOT a problem. And I just want to write a
>simple command-line exe to shutdown my PC, why do I need
>to spend so much? Thanks for your reply anyway.
>
I don't understand the question. The API call docs state that you need a GUI-based application to use the API call in question. What's the big deal? Create a WinMain so that there's a window context, and issue the API call. It works. If you're asking why that requirement exists, direct the question to MS - I don't design the internals of their API calls. ExitWindowsEx() functions from WinApps with a Winmain and WIndows context as it's expected. Under NT, user permissions may limit the functionality, as the environment was designed to do - if a user or process doesn't have the necessary permissions to do a systme shutdown, NT won't shut down because an unprivileged process tried to use the call.
As to why do you need to spend so much on books and documentation; if you want to have the references on hand, aren't satisfied with the details provided in the on-line help that comes with the tools, and can't borrow the necessary references from the library or a friend, buy them. I spend a lot of money to keep current with the environments I develop for, but I'm making more money than I'm spending on the references and tools. GCC is available for free, and it'll generate executable images for a wide range of environments, including the Wintel environments. You're welcome to use GNU products, or the Borland C compiler, or TinyC, or any of the other tools on the market if they fit your needs better than VC++. Just realize that the Win32 API is still going to work the same way, and you don't have the MS-provided support options available for these other products.
>> I think I already directed you to Jeff Richter's
>> "Advanced Windows" for more details on the
>> differences between a console app and a GUI-based app.