DetectAC
Detect AC power status on Windows
Welcome to the new Ogre Wiki!
If you haven't done so already, be sure to visit the Wiki Portal to read about how the wiki works. Especially the Ogre Wiki Overview page.
If you haven't done so already, be sure to visit the Wiki Portal to read about how the wiki works. Especially the Ogre Wiki Overview page.
Table of contents
Why detect AC power status?
Laptops are becoming more and more popular. One advantage is that they can be used without power supply with the help of a battery. Unfortunately when a laptop is not connected to a power supply the performace will be degraded (sometimes considerably). It can be useful to detect this and show a message to the user explaining why the application might not perform very well.
This code snippet shows how the "detecting part" can be done using the Windows API.
Code snippet
bool Utils::GetBatteryCharging() { SYSTEM_POWER_STATUS _status; GetSystemPowerStatus(&_status); if(_status.ACLineStatus == 0) { return false; } else { return true; } }
Dont forget to include windows headers also for this to work:
#include "windows.h"--Borundin? 20:26, 4 July 2008 (BST)
Contributors to this page: jacmoe
and
Borundin
.
Page last modified on Saturday 02 of January, 2010 23:25:00 UTC by jacmoe
.
The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.
Sidebar
Last changes
- Hydrax
- QtOgre
- SoC2012 Complete the DirectX 11 render system
- SoC2012 Volume Rendering with LOD aimed at terrain
- SoC2012 Improve and Demo the Terrain System
- Mogre and WPF
- SoC2012 Implementation of Off-Screen Particles
- Advanced Ogre Framework
- Ogre overlays using Qt
- Architecture and Design in Games
Search box
Online users
34
online users

