Link to home
Start Free TrialLog in
Avatar of jdaues
jdaues

asked on

Shutdown in NT

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"
ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jdaues
jdaues

ASKER

i tried your suggestion and it worked perfectly!
thanks