eymenbex
Öğrenci
- Katılım
- 8 Ağustos 2018
- Mesajlar
- 51
- Reaksiyon puanı
- 15
- Puanları
- 8
C++:
#include <iostream>
#include <windows.h>
#include <sstream>
//message box
template<typename T>
vo id alert(T item){
std::ostringstream os;
os<<item;
MessageBoxA(NULL, os.str().c_str(), "Reminder!", MB_OK | MB_ICONINFORMATION);
}
//Getting the battery lvl
int getBatteryLevel(){
SYSTEM_POWER_STATUS status;
GetSystemPowerStatus(&status);
return status.BatteryLifePercent;
}
int main(){
static std::string t = "Batarya \% 100";
//Actually I'm not sure about this implementation. Gonna try to improve this.
while(true){
int x = getBatteryLevel();
if(x == 100){
alert(t);
break;
}else{
Sleep(20 * 60000);
}
}
return 0;
}