Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to track UPS/battery power
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01414516
Message ID:
01414523
Vues:
75
This message has been marked as a message which has helped to the initial question of the thread.
>Anybody has experience to share of how to apply VFP to detect switching to UPS (when power failure), or just tracking battery power (either laptop or UPS) ?
lcComputer = "."
loWMIService = Getobject("winmgmts:\\" + lcComputer + "\root\cimv2")
colItems = loWMIService.ExecQuery("Select * from Win32_Battery")
For Each loItem In colItems
	?"Availability: " + Transform(loItem.Availability)
	?"Battery Status: " + Transform(loItem.BatteryStatus)
	?"Description: " + loItem.Description
	?"Design Voltage: " + loItem.DesignVoltage
	?"Device ID: " + loItem.DeviceID
	?"Estimated Run Time: " + Transform(loItem.EstimatedRunTime)+ " minutes"
	?"Name: " + loItem.Name
	?"Power Management Supported: " + Transform(loItem.PowerManagementSupported)
	?
Next
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform