Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Shutting Down the Computer
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Shutting Down the Computer
Divers
Thread ID:
00532885
Message ID:
00532885
Vues:
41
Has anyone ever been successful in shutting down/rebooting a computer with VFP? If so, could you show me. I can get the computer to log the current user off but not shutdown or reboot.

Here is the code I used:
Declare ExitWindowsEx in "user32" Long, Long
ExitWindowsEx(EWX_contsant, 1)

Here are the constants:
EWX_FORCE = 4
EWX_LOGOFF = 0
EWX_REBOOT = 2
EWX_SHUTDOWN = 1

Now this only works when I use 4 which just logs the user off.

I looked on msdn and found that under **win 2000**, which is what my users are running, you need to enable the SE_SHUTDOWN_NAME privilage, and it gives an example in c thats pretty complicated, for me anyway.

Here is the message:
Windows NT/2000 or later: To shut down or restart the system, the calling process must use the function to enable the SE_SHUTDOWN_NAME privilege. For more information about security privileges, see Privileges.

Here is the page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/hh/sysmgmt/shutdown_3ago.asp

So if anyone has done it before can you help? Thanks in advance.

-Eric
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform