请问在windows中调用哪个API函数可以实现关机的功能?
请讲详细点!谢谢!

解决方案 »

  1.   

    BOOL ExitWindowsEx(
      UINT uFlags,       // shutdown operation
      DWORD dwReserved   // reserved
    );Parameters
    uFlags Specifies the type of shutdown. This parameter must include one of the following EWX_LOGOFF: Shuts down all processes running in the security context of the process that called the ExitWindowsEx function. Then it logs the user off. 
    EWX_POWEROFF: Shuts down the system and turns off the power. The system must support the power-off feature.
     
    EWX_REBOOT: Shuts down the system and then restarts the system. 
     
    EWX_SHUTDOWN: Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to disk, and all running processes have stopped. dwReserved 
    Reserved; this parameter is ignored. 
    Return Values
    If the function succeeds, the return value is nonzero.