笔记本终于阻止了系统待机了

笔记本终于阻止了系统待机了


function SetThreadExecutionState(esFlags: DWORD
  ): DWORD; stdcall; external 'kernel32.dll';
const
  ES_SYSTEM_REQUIRED = $00000001;
  ES_DISPLAY_REQUIRED = $00000002;
  ES_CONTINUOUS = $80000000;

procedure TForm12.Timer1Timer(Sender: TObject);
begin
  SetThreadExecutionState(ES_SYSTEM_REQUIRED);
  SetThreadExecutionState(ES_DISPLAY_REQUIRED);
end;

经测试,在电源设置为合上本本待机的状态下,合上本本并不会待机!
至于LZ想要的 锁定计算机 可以自己实现,比较简单!

你可能感兴趣的:(笔记)