>Well, it doesn't work in this raw form - I'll have to investigate how to modify the SE_SHUTDOWN_NAME privilege.
You'll need to ensure that the user is either a member of Administrators, or has had the privilege specifically granted to them in User Administrator. There are ways of altering your privilege mask by impersonation (see the Win32 API guides) but I've never used impersonation anywhere but in a Service, and never from VFP.
Your best bet will be to simply adjust the account privilege sets outside of your app so that the ExitWindows() call will act on the request.
If an interactive shutdown is an option, and you've installed Windows Scripting Host on all systems involved, you could also look at using the ExitWindows method of the Wscript.Shell object.
>
>>>I could have sworn I saw a KB article around here on how to force an NT system to shut down and restart.
>>>
>>>I have an application that runs 24x7, and I'm experiencing odd troubles with it. I suspect a memory leak, and I just want to have the app shut down and restart WinNT every morning at 3:00 or something.
>>>
>>>Other apps will be running, but I suspect they will respond to the Windows shutdown message.
>>>
>>Hi Michael,
>>
>>I don't know if this'll do it on NT, but try the following:
>>#DEFINE EWX_REBOOT 2
>>DECLARE SHORT ExitWindowsEx IN Win32API;
>> SHORT uFlags, INTEGER dwReserved
>>= ExitWindowsEx(EWX_REBOOT, 0)
>>According to the documentation on NT, "The calling process must have the SE_SHUTDOWN_NAME privilege....To shut down or restart the system, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege."
>>
>>hth,