Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To prevent the system from entering idle mode you may try to use the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa373208%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>SetThreadExecutionState</code></a> function. This function informs the system that the application is in use and allows you to specify the thread's execution requirements. The usage can be like this, but I'm not sure if this affects also the disk power down timer:</p> <pre><code>type EXECUTION_STATE = DWORD; const ES_SYSTEM_REQUIRED = $00000001; ES_DISPLAY_REQUIRED = $00000002; ES_USER_PRESENT = $00000004; ES_AWAYMODE_REQUIRED = $00000040; ES_CONTINUOUS = $80000000; function SetThreadExecutionState(esFlags: EXECUTION_STATE): EXECUTION_STATE; stdcall; external 'kernel32.dll' name 'SetThreadExecutionState'; procedure TForm1.Button1Click(Sender: TObject); begin if SetThreadExecutionState(ES_CONTINUOUS or ES_SYSTEM_REQUIRED or ES_AWAYMODE_REQUIRED) &lt;&gt; 0 then try // execute your long running task here finally SetThreadExecutionState(ES_CONTINUOUS); end; end; </code></pre> <p>Or there is also available the new set of functions <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd405533%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>PowerCreateRequest</code></a>, <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd405534%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>PowerSetRequest</code></a> and <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd405532%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>PowerClearRequest</code></a> designed for Windows 7, but the documentation is confusing and I haven't found any example of their usage at this time.</p> <p>Or you can modify the power settings by <a href="http://msdn.microsoft.com/en-us/library/aa372765%28v=VS.85%29.aspx" rel="nofollow noreferrer"><code>PowerWriteACValueIndex</code></a> or <a href="http://msdn.microsoft.com/en-us/library/aa372769%28v=VS.85%29.aspx" rel="nofollow noreferrer"><code>PowerWriteDCValueIndex</code></a> functions with the <code>GUID_DISK_SUBGROUP</code> subgroup of power settings.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload