开发者

How to make Windows go to sleep from app?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜