How can I turn off the device in my program? Many Thanks!

I use the followed method, but it doesn't work:

ExitWindowsEx(EWX_POWEROFF, 0);

If I use the following codes, it can reboot:

ExitWindowsEx(EWX_REBOOT, 0);

Please Help!




Answer this question

How can I turn off the device in my program? Many Thanks!

  • jordanb412

    SetSystemPowerState Should help

    This takes the required power state , with some options

    Different power states being on, off, boot, critical , idle ,suspend, reset and password protected

    use pm.h and coredll.lib to link

    Regards

    Srikanth Bogadapti



  • How can I turn off the device in my program? Many Thanks!