Arsip: BANTU ENE BUAT PROGRAM BATREY STATUS

 
user image
more 13 years ago

dedidavidbala

AGAN2 DELHI INDONESI..SALAM KENAL...GWA MO NANX..CARA BUAT PROGRAM BATREY STATUS PADA WINDOWS..TIDAK TAU NE CARANYA DARI MANA GAN... KARNA DI SINI TIDAK BISA TAMPILIN GAMBAR ATAU CONTOH2 GAMBAR YANG MAU DI BUAT.... INI AGAN LINK YANG BISA DI LIAT...HELPP http://www.mydigitallife.info/monitor-status-of-laptop-battery-for-more-accurate-result-with-batterybar/ http://www.kaskus.us/showthread.php?p=438309220#post438309220 INI ADA CONTOH LISTING YANG DA DI KASI TEMEN2..CUMA GWA BINGGUNG MAU PAKE GIMANA...PUSING BARU KENAL LEBIH JAUH TENTANG DELPHI procedure TForm1.Timer1Timer(Sender: TObject); begin getsystempowerstatus(syspowerstatus); If syspowerstatus.ACLineStatus = 1 then begin Label1.Caption := Format('Power : %u percent',); Label2.Caption := Format('Lifetime : %u ',); Label3.Caption := Format('Full Lifetime : %u',); end else begin Application.MessageBox('Battery Di Cabut','Peringatan'); end; end; // function GetBattery : Boolean; var SysPowerStatus: TSystemPowerStatus; begin Win32Check(GetSystemPowerStatus(SysPowerStatus)); case SysPowerStatus.ACLineStatus of 0: Result := False; 1: begin Result := True; // You can return life with // String := Format('Battery power left: %u percent.', SysPowerStatus.BatteryLifePercent]); end; else raise Exception.Create('Unknown battery status'); end; end; MAAF KLO NEWBIE.....BANTU YA MASTER2 DELPHI...PUSING MO KONSUL DIMANA LAGI..MO BIKIN TUGAS AKHIR..NE
user image
more 13 years ago

madi

ente musti punya component yg namanya TSystemPowerStatus; solusinya, tanyaiin temen2 ente, darimana tuh dapetin componentnya
user image
more 13 years ago

mas_kofa

setau saya function GetSystemPowerStatus ada di windowsAPI (kernel32.dll)......... berikut contoh penggunaan di VB... untuk delphi saya kira mudah untuk mengkoversi nya dr code vb di bawah

Private Type SYSTEM_POWER_STATUS
ACLineStatus As Byte
BatteryFlag As Byte
BatteryLifePercent As Byte
Reserved1 As Byte
BatteryLifeTime As Long
BatteryFullLifeTime As Long
End Type
Private Declare Function GetSystemPowerStatus Lib "kernel32" (lpSystemPowerStatus As _ SYSTEM_POWER_STATUS) As Long
Private Sub Form_Paint()
Dim SPS As SYSTEM_POWER_STATUS
'get the battery powerstatus
GetSystemPowerStatus SPS
Me.AutoRedraw = True
'show some information
Select Case SPS.ACLineStatus
Case 0
Me.Print "AC power status: Offline"
Case 1
Me.Print "AC power status: OnLine"
Case 2
Me.Print "AC power status: Unknown"
End Select
Select Case SPS.BatteryFlag
Case 1
Me.Print "Battery charge status: High"
Case 2
Me.Print "Battery charge status: Low"
Case 4
Me.Print "Battery charge status: Critical"
Case 8
Me.Print "Battery charge status: Charging"
Case 128
Me.Print "Battery charge status: No system battery"
Case 255
Me.Print "Battery charge status: Unknown Status"
End Select
End Sub
user image
more 13 years ago

dedidavidbala

@mas_kofa: setau saya function GetSystemPowerStatus ada di windowsAPI (kernel32.dll)......... berikut contoh penggunaan di VB... untuk delphi saya kira mudah untuk mengkoversi nya dr code vb di bawah

Private Type SYSTEM_POWER_STATUS
ACLineStatus As Byte
BatteryFlag As Byte
BatteryLifePercent As Byte
Reserved1 As Byte
BatteryLifeTime As Long
BatteryFullLifeTime As Long
End Type
Private Declare Function GetSystemPowerStatus Lib "kernel32" (lpSystemPowerStatus As _ SYSTEM_POWER_STATUS) As Long
Private Sub Form_Paint()
Dim SPS As SYSTEM_POWER_STATUS
'get the battery powerstatus
GetSystemPowerStatus SPS
Me.AutoRedraw = True
'show some information
Select Case SPS.ACLineStatus
Case 0
Me.Print "AC power status: Offline"
Case 1
Me.Print "AC power status: OnLine"
Case 2
Me.Print "AC power status: Unknown"
End Select
Select Case SPS.BatteryFlag
Case 1
Me.Print "Battery charge status: High"
Case 2
Me.Print "Battery charge status: Low"
Case 4
Me.Print "Battery charge status: Critical"
Case 8
Me.Print "Battery charge status: Charging"
Case 128
Me.Print "Battery charge status: No system battery"
Case 255
Me.Print "Battery charge status: Unknown Status"
End Select
End Sub
makasi ya riply nya...,, mo nanya lagi di mana saya bisa dapat komponent ZylBattery 1.23 Delphi Component..gini gan..aku hanya dapat fersi demonya dari situsnya.....tidak ada yang full fersion komponentnya,,,,,gwa jga,,binggung cara belinya....sapa tau ada parah master2 delphi yang punya helpp kali ini... ini conto code yang dikasi dari ZylBattery 1.23 Delphi Component
[quote]unit FDemo;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, Gauges, ZylBattery, ExtCtrls, StdCtrls;
type
  TForm1 = class(TForm)
    ZylBattery1: TZylBattery;
    Label1: TLabel;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
var
  strMsg: String;
begin
  strMsg := '';
  if bsHigh in ZylBattery1.GetBatteryStatus then
  begin
    strMsg := strMsg + ' High';
  end;
  if bsLow in ZylBattery1.GetBatteryStatus then
  begin
    strMsg := strMsg + ' Low';
  end;
  if bsCritical in ZylBattery1.GetBatteryStatus then
  begin;
    strMsg := strMsg + ' Critical';
  end;
  if bsCharging in ZylBattery1.GetBatteryStatus  then
  begin
    strMsg := strMsg + ' Charging';
  end;
  if bsNoBattery in ZylBattery1.GetBatteryStatus  then
  begin
    strMsg := strMsg + ' No battery';
  end;
  if bsUnknown in ZylBattery1.GetBatteryStatus then
  begin
    strMsg := strMsg + ' Unkown';
  end;
  label1.Caption := 'Status:' + strMsg;
end;
end.
[/quote] :lol:
more ...
  • Pages:
  • 1
Share to
Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com