...den Power Status überprüfen?

Autor: Simon Grossenbacher
Homepage: http://www.swissdelphicenter.ch

Kategorie: System

procedure TForm1.Button1Click(Sender: TObject);
var
  SysPowerStatus: TSystemPowerStatus;
begin
  GetSystemPowerStatus(SysPowerStatus);
  if Boolean(SysPowerStatus.ACLineStatus) then
  begin
    ShowMessage('System running on AC.');
  end
  else
  begin
    ShowMessage('System running on battery.');
    ShowMessage(Format('Battery power left: %d percent.', [SysPowerStatus.BatteryLifePercent]));
  end;
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base