Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Turn off the computer
Message
From
16/12/1999 21:18:35
 
 
To
16/12/1999 21:07:05
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00305053
Message ID:
00305061
Views:
18
>Hi, is there a way to turn off my computer from inside a Visual Foxpro 6 aplication?
>

There's a Windows API call that can do this (ExitWindowsEx()) which is described here in the UT FAQ. You can reliably shut down Win9x systems using it, however, processes need a specific permission (SE_SHUTDOWN_NAME) to be able to do more than log out the current user under NT and Win2K; if the user has adequate privileges, the SE_SHUTDOWN_NAME privilege can be enabled using the AdjustTokenPrivileges() API call. Using AdjustTokenPrivileges() is not trivial in VFP; some sample C code that demonstrates its use can be found at http://www.mvps.org/win32/processes/rb.c
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
Reply
Map
View

Click here to load this message in the networking platform