PC NAME & Draw Battery Life
I Orginally Posted these in a Thread but Threads Die So Here Ya Go
Draw PC NAME:
Code:
char pcName [MAX_COMPUTERNAME_LENGTH + 1];
DWORD dwPcName = sizeof ( pcName );
if ( GetComputerName (pcName,&dwPcName)) cFont->DrawText(300,300,Green,pcName,D3DFONT_SHADOW);
Draw Battery Life:
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;
}
}