A Windows battery monitoring application that plays an audio alert when your laptop battery reaches 11% charge while connected to AC power. This helps prevent overcharging and extends battery lifespan.
- Real-time Battery Monitoring: Continuously checks battery status every 500ms
- Audio Alerts: Plays
alert.wavsound when conditions are met - Configurable Thresholds: Battery percentage limit set to 11% (can be modified in source)
- Low Resource Usage: Lightweight background application with minimal system impact
- No GUI: Runs silently in the background
- Language: C++
- Platform: Windows (uses Windows API)
- Dependencies:
windows.hfor system power statusmmsystem.hfor audio playback
- Alert Conditions: Triggers when:
- Device is connected to AC power (charging)
- Battery percentage is ≥ 11%
- Alert Interval: 1 second between repeated alerts
- Double-click
BatteryApp.exeto start the application - No user interface will appear - the program runs silently in the background
- To verify it's running:
- Open Task Manager (
Ctrl + Shift + Esc) - Look for "BatteryApp (32 bit)" in the process list
- Open Task Manager (
- The program will play an alert sound when your battery reaches the threshold while charging
To use: Simply double-click the BatteryApp.exe file
To uninstall: Delete the BatteryApp folder
To automatically start BatteryApp when Windows boots:
- Press
Win + Rto open the Run dialog - Type
%ProgramData%and click OK - Navigate to:
Microsoft → Windows → Start Menu → Programs - Copy the BatteryApp folder into the Programs folder
- The program will now start automatically on every boot
If you want to modify or compile the application:
-
Requirements:
- Windows development environment
- C++ compiler with Windows SDK support
- Link against
winmm.libfor audio functionality
-
Compilation:
g++ -o BatteryApp.exe main.cpp -lwinmm
-
Customization:
- Modify
batteryPercentageLimit(line 14) to change alert threshold - Adjust
alertInterval(line 9) to change time between alerts - Change
sleepInterval(line 11) to modify monitoring frequency
- Modify
BatteryApp/
├── main.cpp # Source code
├── BatteryApp.exe # Compiled executable
├── alert.wav # Audio file for alerts
└── README.md # This file
- Ensure
alert.wavis in the same directory as the executable - The application will continue running until manually terminated
- Battery percentage threshold is currently set to 11% (not 98% as originally stated)
- Works only on Windows systems with battery support