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.
精彩评论