?
Solved

Detecting power loss

Posted on 2004-11-19
2
Medium Priority
?
457 Views
Last Modified: 2007-12-19
I have a vb application that will be left running 24/7.
The PC will be fitted with a UPS so I need to detect when the mains power fails and the ups kicks in so that I can safely close the application.
I have tried the GetSystemPowerStatus API but this only seems to work with laptops ie, detects when the laptop goes from mains to battery.

Anyone know how I can detect through vb when the ups kicks in?
0
Comment
Question by:monthathip
1 Comment
 
LVL 4

Accepted Solution

by:
divt earned 1500 total points
ID: 12624371
monthathip,

I believe the UPS has been connected to the computer through a port.  You should look at the documentation that comes with the UPS to know how to retrieve status of the UPS.  Such UPS may come with its own software, and the software may be configured to take some actions (send emails, open an application, run a script, etc.) based on its status.  If there is no documentation on port communication, you may have it trigger a script which does something.

hope this helps.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question