代码之家  ›  专栏  ›  技术社区  ›  Renaud Bompuis

如何以编程方式使笔记本电脑进入睡眠模式

  •  4
  • Renaud Bompuis  · 技术社区  · 16 年前

    谢谢你的指点。

    2 回复  |  直到 10 年前
        1
  •  10
  •   Leon Tayson    16 年前

    查看SystemInformation.PowerStatus,然后您可以调用Application.SetSuspendState使电脑进入睡眠或休眠状态,如:

    Application.SetSuspendState(PowerState.Hibernate, true, true);
    
        2
  •  1
  •   dsrdakota    12 年前

    您可以使用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
    

    请参阅API here .

    推荐文章