laptop batery
Tarih
04/05/2012 15:32
Konu Sahibi
accessman
Yorumlar
0
Okunma
777
Konuyu Oyla:
  • Derecelendirme: 0/5 - 0 oy
  • 5
  • 4
  • 3
  • 2
  • 1

Derecelendirme: 0/5 - 0 oy



accessman

Kullanici Avatari
Onursal
2.367
31/10/2008
425
Denizli
Ofis 2003
20/09/2016,00:20

Kod:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Public Function getBatteryStatus() As Integer
  Dim obj As Object, obj2 As Object, stat As Integer
'  Get Battery Status
'  Return Value Meaning
'0 No battery
'1 The battery is discharging.
'2 The system has access to AC so no battery is being discharged. However, the battery is not necessarily charging.
'3 Fully Charged
'4 Low
'5 Critical
'6 Charging
'7 Charging and High
'8 Charging and Low
'9 Charging and Critical
'10 Undefined
'11 Partially Charged
  stat = 0
  Set obj = GetObject("winmgmts:").InstancesOf("Win32_Battery")
  For Each obj2 In obj 'loop in objects
    stat = obj2.BatteryStatus
  Next
  getBatteryStatus = stat
End Function

Kod:
Private Sub Form_Load()
    MsgBox "Battery status: " & getBatteryStatus(), vbInformation + vbOKOnly, "Battery Status"
    End
End Sub

@benbendedeilem
Cevapla







Konuyu Okuyanlar: 1 Ziyaretçi



Türkçe Çeviri: MCTR, Forum Yazılımı: MyBB, © 2002-2016 MyBB Group.
DMCA.com Protection Status
© Desing by XSTYLED| Develops by ozanakkaya