我可以使用哪些API或工具来查询系统功能,并选择最合适的用于将PC置于睡眠,休眠或关机模式?
感谢您的任何指示。
答案 0 :(得分:10)
查看SystemInformation.PowerStatus,然后可以调用Application.SetSuspendState将PC置于Sleep或Hibernate状态:
Application.SetSuspendState(PowerState.Hibernate, true, true);
答案 1 :(得分:1)
您可以使用API:
Declare Function SetSuspendState Lib "PowrProf" (ByVal Hibernate As Integer, ByVal ForceCritical As Integer, ByVal DisableWakeEvent As Integer) As Integer
SetSuspendState(0, 0, 0) 'Sleep without forcing and ?no? wake events
SetSuspendState(1, 0, 0) 'Hibernate without forcing and ?no? wake events
将Hibernate设置为1(True)为Hibernate或0(False)为Sleep。
请参阅API here。