我有一个问题,在进入待机模式之前我需要清理一些东西。 问题是,当客户按下电源按钮(如果配置为进入休眠模式)时,我也需要这样做。
PowerSetRequest(_PowerRequest, PowerRequestType.PowerRequestAwayModeRequired);
这个不行,电脑直接休眠。
我也试过
SetThreadExecutionState(EXECUTION_STATE.ES_DISPLAY_REQUIRED | EXECUTION_STATE.ES_SYSTEM_REQUIRED );
但也失败了。
有人给我提示吗?
最佳答案
以下引自SetThreadExecutionState function表明这不再可能:
The SetThreadExecutionState function cannot be used to prevent the user from putting the computer to sleep. Applications should respect that the user expects a certain behavior when they close the lid on their laptop or press the power button.
关于c# - W7 : Clean up before go to stand by,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30068952/