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.aspSo if anyone has done it before can you help? Thanks in advance.
-Eric