乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Delphi 操作Windows系統(tǒng)睡眠

       獨(dú)孤求財 2021-04-29
      unit SystemCriticalU;
      interface
      uses
        Windows;
      type
        TSystemCritical = class
        private
          FIsCritical: Boolean;
          procedure SetIsCritical(const Value: Boolean) ;
        protected
          procedure UpdateCritical(Value: Boolean) ; virtual;
        public
          constructor Create;
          property IsCritical: Boolean read FIsCritical write SetIsCritical;
        end;
      var
        SystemCritical: TSystemCritical;
      implementation
      { TSystemCritical }
      // REF: http://msdn.microsoft.com/en-us/library/aa373208.aspx
      type
        EXECUTION_STATE = DWORD;
         
      const
        ES_SYSTEM_REQUIRED = $00000001;
        ES_DISPLAY_REQUIRED = $00000002;
        ES_USER_PRESENT = $00000004;
        ES_AWAYMODE_REQUIRED = $00000040;
        ES_CONTINUOUS = $80000000;
         
        KernelDLL = 'kernel32.dll';
      {
        SetThreadExecutionState Function
        Enables an application to inform the system that it is in use,
        thereby preventing the system from entering sleep or turning off the
        display while the application is running.
      }
      procedure SetThreadExecutionState(ESFlags: EXECUTION_STATE);
        stdcall; external kernel32 name 'SetThreadExecutionState';
      constructor TSystemCritical.Create;
      begin
        inherited;
        FIsCritical := False;
      end;
      procedure TSystemCritical.SetIsCritical(const Value: Boolean) ;
      begin
        if FIsCritical = Value then
          Exit;
        FIsCritical := Value;
        UpdateCritical(FIsCritical);
      end;
      procedure TSystemCritical.UpdateCritical(Value: Boolean) ;
      begin
        if Value then
          // 防止睡眠空閑超時和關(guān)機(jī)。
          SetThreadExecutionState(ES_SYSTEM_REQUIRED or ES_CONTINUOUS)
        else
          //清除執(zhí)行狀態(tài)標(biāo)志以禁用離開模式并允許
          // 系統(tǒng)空閑以正常睡眠
          SetThreadExecutionState(ES_CONTINUOUS);
      end;
      initialization
      SystemCritical := TSystemCritical.Create;
      finalization
      SystemCritical.IsCritical := False;
      SystemCritical.Free;
      end. 

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多