Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Turn off the computer
Message
De
16/12/1999 21:18:35
 
 
À
16/12/1999 21:07:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00305053
Message ID:
00305061
Vues:
17
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform