Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ExWindowsEx() and Visual C++
Message
From
04/04/1999 23:23:29
 
 
To
04/04/1999 23:09:07
Man Wai Chang
Hang Hing Metal Manufacturer
Hung Hom, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00205131
Message ID:
00205138
Views:
36
>I compiled the following simple Win32 application using
>VC++ 6.0 in Win95 but the program didn't work. It just
>exited like a normal application without shutting down
>the PC. What's wrong?
>
>
>// shutdown.cpp
>#include "stdafx.h"
>#include "windows.h"
>
>void main(int argc, char* argv[])
>{
>        ExitWindowsEx(EWX_SHUTDOWN, 0);
>}
>
>
Are you running under NT? If so, the user needs specific permissions to be able to force a shutdown from an application; you'll need to use AdjustTokenPrivileges to enable the SE_SHUTDOWN_NAME privilege. You'll also probably need to use both EWX_FORCE and EWX_SHUTDOWN to avoid dialogs in any case.

Under Win95, ExitWindowsEx doesn't function properly from a console application. See the MSDN documentation for details.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform