Shutdown in NT
Posted on 1998-03-10
i am trying to programatically shut down the computer, in Windows NT, but i receive an "Access is denied" error on the call to InitiateSystemShutdown. how can i gain this access?
(code snippet follows)
// shut down
iReturn = InitiateSystemShutdown (NULL, // address of name of computer to shut down
NULL, // address of message to display in dialog box
0, // seconds to display dialog box
FALSE, // force applications with unsave
FALSE); // don't reboot flag
if (iReturn == FALSE) // if InitiateSystemShutdown call failed
iError = GetLastError(); // iError = 5, which is "Access is denied"