Question

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.

Was it helpful?

Solution

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

OTHER TIPS

I believe this MSDN page will help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top