Restored from previous forum. Originally posted by cor.
;Question
;How To define SPS as mentioned below from he original api reference ;SYSTEM_POWER_STATUS ( see below source for documentation
;Thanks
;Cor
; batterystatus
If OpenConsole()
If GetSystemPowerStatus_(SPS) 0
PrintN("Powerstatus is available")
Else
PrintN("Powerstatus cannot be detected!!!!")
EndIf
temp$= Input()
EndIf
CloseConsole()
End
;====================
; end of source
;====================
;The GetSystemPowerStatus function retrieves the power status of the system. The status indicates whether the system is running on AC Or DC power, whether the battery is currently charging, And how much battery life currently remains.
;BOOL GetSystemPowerStatus(LPSYSTEM_POWER_STATUS lpSystemPowerStatus);parameters
;lpSystemPowerStatus
;Pointer To a SYSTEM_POWER_STATUS Structure that receives status information.
;Return Values
;If the function succeeds, the Return value is nonzero.
;If the function fails, the Return value is zero.
;The SYSTEM_POWER_STATUS Structure contains information about the power status of the system.
;typedef struct _SYSTEM_POWER_STATUS {
BYTE ACLineStatus;
BYTE BatteryFlag;
BYTE BatteryLifePercent;
BYTE Reserved1;
DWORD BatteryLifeTime;
DWORD BatteryFullLifeTime;
;} SYSTEM_POWER_STATUS;
;typedef struct SYSTEM_POWER_STATUS *LPSYSTEM_POWER_STATUS;
;Members
;ACLineStatus
;AC power status. This parameter can be one of the following values:
;Value Meaning
;0 Offline
;1 Online
;255 Unknown status.
;All other values are reserved.
;BatteryFlag
;Battery charge status. This parameter can be a combination of the following values:
;Value Meaning
;1 High
;2 Low
;4 Critical
;8 Charging
;128 No system battery
;255 Unknown status
;All other values are reserved.
;BatteryLifePercent
;Percentage of full battery charge remaining. This member can be a value in the range 0 To 100, Or 255 If status is unknown. All other values are reserved.
;Reserved1
;Reserved; must be zero.
;BatteryLifeTime
;Number of seconds of battery life remaining, Or 0xFFFFFFFF If remaining seconds are unknown.
;BatteryFullLifeTime
;Number of seconds of battery life when at full charge, Or 0xFFFFFFFF If full lifetime is unknown.
;Remarks
;Windows 95 is only capable of estimating BatteryFullTime based on calculations on BatteryLifeTime And BatteryLifePercent. Without smart battery subsystems, this value may not be accurate enough To be useful.
Registered user of PB
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
Question abut API call?
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by El_Choni.
Add this line. If PureBasic has this structure defined, it'll work:
Otherwise, add:
Hope it helps. Regards,
El_Choni
Add this line. If PureBasic has this structure defined, it'll work:
Code: Select all
SPS.SYSTEM_POWER_STATUS
Code: Select all
Structure SYSTEM_POWER_STATUS
ACLineStatus.b;
BatteryFlag.b;
BatteryLifePercent.b;
Reserved1.b;
BatteryLifeTime.l;
BatteryFullLifeTime.l;
EndStructure
El_Choni
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by cor.
It doesn't work SPS not defines
Cor
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
It doesn't work SPS not defines
Cor
Registered user of PBAdd this line. If PureBasic has this structure defined, it'll work:
Otherwise, add:Code: Select all
SPS.SYSTEM_POWER_STATUS
Hope it helps. Regards,Code: Select all
Structure SYSTEM_POWER_STATUS ACLineStatus.b; BatteryFlag.b; BatteryLifePercent.b; Reserved1.b; BatteryLifeTime.l; BatteryFullLifeTime.l; EndStructure
El_Choni
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.
Did you add the lines El_Choni prompted you to do? Your program should look something like this:
Edited by - Pupil on 09 January 2002 17:21:10
It doesn't work SPS not defines
Cor
Did you add the lines El_Choni prompted you to do? Your program should look something like this:
Code: Select all
SPS.SYSTEM_POWER_STATUS ; now SPS is defined
If OpenConsole()
If GetSystemPowerStatus_(SPS) 0
PrintN("Powerstatus is available")
Else
PrintN("Powerstatus cannot be detected!!!!")
EndIf
temp$= Input()
EndIf
CloseConsole()
End
Edited by - Pupil on 09 January 2002 17:21:10