home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / classlib / desaware / dwsyspwr.cls < prev    next >
Encoding:
Text File  |  1996-02-18  |  2.3 KB  |  83 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "dwSysPower"
  6. Attribute VB_Creatable = True
  7. Attribute VB_Exposed = True
  8. Option Explicit
  9.  
  10. ' Class dwSysPower
  11. ' Desaware API Class library
  12. ' Copyright (c) 1996 by Desaware Inc.
  13. ' All rights reserved
  14.  
  15. #If Win32 Then
  16. Private iSysPower As SYSTEM_POWER_STATUS
  17.  
  18. Public Sub SetSysPower(ACLineStatus As Byte, BatteryFlag As Byte, BatteryLifePercent As Byte, Reserved1 As Byte, BatteryLifeTime As Long, BatteryFullLifeTime As Long)
  19.     iSysPower.ACLineStatus = ACLineStatus
  20.     iSysPower.BatteryFlag = BatteryFlag
  21.     iSysPower.BatteryLifePercent = BatteryLifePercent
  22.     iSysPower.Reserved1 = Reserved1
  23.     iSysPower.BatteryLifeTime = BatteryLifeTime
  24.     iSysPower.BatteryFullLifeTime = BatteryFullLifeTime
  25. End Sub
  26.  
  27. Public Sub CopyToSYSPOWER(ByVal lpSysPower As Long)
  28.     Dim sp As SYSTEM_POWER_STATUS
  29.     
  30.     If lpSysPower = 0 Then RaiseError 5, "dwSysPower"
  31.     agCopyData iSysPower, ByVal lpSysPower, Len(sp)
  32. End Sub
  33.  
  34. Public Property Get ACLineStatus() As Byte
  35.     ACLineStatus = iSysPower.ACLineStatus
  36. End Property
  37.  
  38. Public Property Let ACLineStatus(vNewValue As Byte)
  39.     iSysPower.ACLineStatus = vNewValue
  40. End Property
  41.  
  42. Public Property Get BatteryFlag() As Byte
  43.     BatteryFlag = iSysPower.BatteryFlag
  44. End Property
  45.  
  46. Public Property Let BatteryFlag(vNewValue As Byte)
  47.     iSysPower.BatteryFlag = vNewValue
  48. End Property
  49.  
  50. Public Property Get BatteryLifePercent() As Byte
  51.     BatteryLifePercent = iSysPower.BatteryLifePercent
  52. End Property
  53.  
  54. Public Property Let BatteryLifePercent(vNewValue As Byte)
  55.     iSysPower.BatteryLifePercent = vNewValue
  56. End Property
  57.  
  58. Public Property Get Reserved1() As Byte
  59.     Reserved1 = iSysPower.Reserved1
  60. End Property
  61.  
  62. Public Property Let Reserved1(vNewValue As Byte)
  63.     iSysPower.Reserved1 = vNewValue
  64. End Property
  65.  
  66. Public Property Get BatteryLifeTime() As Long
  67.     BatteryLifeTime = iSysPower.BatteryLifeTime
  68. End Property
  69.  
  70. Public Property Let BatteryLifeTime(vNewValue As Long)
  71.     iSysPower.BatteryLifeTime = vNewValue
  72. End Property
  73.  
  74. Public Property Get BatteryFullLifeTime() As Long
  75.     BatteryFullLifeTime = iSysPower.BatteryFullLifeTime
  76. End Property
  77.  
  78. Public Property Let BatteryFullLifeTime(vNewValue As Long)
  79.     iSysPower.BatteryFullLifeTime = vNewValue
  80. End Property
  81.  
  82. #End If ' this class only exists in win32
  83.