9 Ekim 2018 Salı

Power Management

Advanced Configuration and Power Interface (ACPI)
Açıklaması şöyle.
In a computer, the Advanced Configuration and Power Interface (ACPI) provides an open standard that operating systems can use to discover and configure computer hardware components, to perform power management by (for example) putting unused components to sleep, and to perform status monitoring. First released in December 1996, ACPI aims to replace Advanced Power Management (APM), the MultiProcessor Specification, and the Plug and Play BIOS (PnP) Specification.[1] ACPI brings the power management under the control of the operating system, as opposed to the previous BIOS-centric system that relied on platform-specific firmware to determine power management and configuration policies.
Internally, ACPI advertises the available components and their functions to the operating system kernel using instruction lists ("methods") provided through the system firmware (Unified Extensible Firmware Interface (UEFI) or BIOS), which the kernel parses. ACPI then executes the desired operations (such as the initialization of hardware components) using an embedded minimal virtual machine.
SetThreadExecutionState
Şöyle yaparız.
//sets the appropriate flags to prevent system to go into sleep mode.
SetThreadExecutionState(ES_CONTINUOUS|ES_SYSTEM_REQUIRED|ES_AWAYMODE_REQUIRED);

// This clears the flags and allows the system to sleep normally.
SetThreadExecutionState(ES_CONTINUOUS);
ES_CONTINUOUS 
Tek başına kullanılırsa bayrakları siler. Tek başına değilse belirtilen bayrakları atar.

ES_SYSTEM_REQUIRED
System Idle Timer'ı temizler

ES_AWAYMODE_REQUIRED
Ekran kararır ancak bilgisayar uykuya geçmez.

Ekranı kapatmak
Açıklaması şöyle

SC_MONITORPOWER
0xF170
Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.
The lParam parameter can have the following values:
  • -1 (the display is powering on)
  • 1 (the display is going to low power)
  • 2 (the display is being shut off)
Şöyle yaparız.
SendMessage(handle, WM_SYSCOMMAND, SC_MONITORPOWER, 2);


Hiç yorum yok:

Yorum Gönder