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
Divers
Thread ID:
00532885
Message ID:
00532959
Vues:
13
Eric:
This works for me in Win98SE (from Windows API section by Erik Moore <-- check this out).

DECLARE SHORT ExitWindowsEx IN Win32API;
SHORT uFlags, INTEGER dwReserved

uFlags may be one of the following values:

#DEFINE EWX_LOGOFF 0
#DEFINE EWX_SHUTDOWN 1
#DEFINE EWX_REBOOT 2
#DEFINE EWX_FORCE 4
#DEFINE EWX_POWEROFF 8

=ExitWindowsEx(1,0)

If you want to machine the shutdown immediately, you must, if any, disconnect all mapping from remote machines first.

>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform