开发者

How to make Windows go to sleep from app?

开发者 https://www.devze.com 2023-01-24 00:05 出处:网络
Im trying to make an开发者_运维知识库 app that can put windows 7 to sleep, I have been looking at WM_Messages, but cant seem to find one that does the jobb.

Im trying to make an开发者_运维知识库 app that can put windows 7 to sleep, I have been looking at WM_Messages, but cant seem to find one that does the jobb.

I can use ether C++ or Delphi to make the app if there it makes any difference.


Use SetSuspendState function which is in powrprof.dll:

function SetSuspendState(hibernate, forcecritical, disablewakeevent: boolean): boolean;
    stdcall; external 'powrprof.dll' name 'SetSuspendState';

SetSuspendState(false, false, false); // stand by
SetSuspendState(true, false, false); // hibernate


I believe this MSDN page will help.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号