[Share]Get Battery Life

Posts 1–9 of 9 · Page 1 of 1
[Share]Get Battery Life
Hello..

I thought i would release the functions i made for my menu in the D3D menu competition. so heres one..

Code:

void Drawbatterylife( int x, int y )
{
	SYSTEM_POWER_STATUS status;

	GetSystemPowerStatus( &status );
	int life = status.BatteryLifePercent;
	char szLife[256];

	sprintf(szLife,"%i",life);
	DrawString(x, y, White, m_font, szLife);

       switch (status.BatteryFlag) 
	{

	   case 1: 
		 DrawString( x, y + 17, White, m_font, "High");
		 break;

	   case 2: 
	                    DrawString( x, y + 17, White, m_font, "Low");
	                    break;

                       case 4: 
	                   DrawString( x, y + 17, White, m_font, "Criticial");
                                       break;

	   case 128: 
		   DrawString( x, y + 17, White, m_font, "No system battery");
		   break;

                      case 256: 
                                        DrawString( x, y + 17, White, m_font, "Unknown status");
                                        break;

	}


}
Call in any drawing function..
I'm using a desktop and it displays critical =3
Quote Originally Posted by Hell_Demon View Post
I'm using a desktop and it displays critical =3
should display "No system battery" im thinkin..
Quote Originally Posted by Hell_Demon View Post
I'm using a desktop and it displays critical =3
HD's Deesktop must be powered by the AA's in his mouse.
Quote Originally Posted by why06 View Post


HD's Deesktop must be powered by the AA's in his mouse.
I hate wireless crap that runs out of batteries, so using mouse & keyboard like they supposed to be, with a cord
Quote Originally Posted by why06 View Post


HD's Deesktop must be powered by the AA's in his mouse.

......
A bit late but, this should have gone in the snippet thread.
Quote Originally Posted by Void View Post
A bit late but, this should have gone in the snippet thread.
Ohh i see ..
Idk i never read the damn stickies..

But should i go ahead and put thar ?

Ill do it anyways
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us