Windows Mobile 5.0 기기에서 백라이트 꺼지지 않도록 하기
프로그래밍/개발/Blackjack(SPH-M6200) 2007/10/18 02:48Windows Mobile 용 프로그램은 자체 전원관리에 의하여 백라이트가 꺼지고 화면이 꺼지는 작동을 하게 된다.
만약 동영상 플레이어나 기타 프로그램을 만들 경우 백라이트가 꺼지지 않는 것을 원할 수 있는데, 다음과 같은 코드를 이용하면 된다.
void SetBacklightRequirement(BOOL fBacklightOn)
{
// The name of the backlight device.
TCHAR tszBacklightName[] = TEXT("BKL1:");
static HANDLE s_hBacklightReq = NULL;
if (fBacklightOn)
{
if (NULL == s_hBacklightReq)
{
// Turn the backlight on by setting the requirement that the backlight device
// must remain in device state D0 (full power). Replace D0 with D4 (zero power) to
// turn the backlight off.
s_hBacklightReq = SetPowerRequirement(tszBacklightName, D0, POWER_NAME, NULL, 0);
if (!s_hBacklightReq)
RETAILMSG(1, (L"SetPowerRequirement failed: %X\n", GetLastError()));
}
}
else
{
if (s_hBacklightReq)
{
if (ERROR_SUCCESS != ReleasePowerRequirement(s_hBacklightReq))
RETAILMSG(1, (L"ReleasePowerRequirement failed: %X\n", GetLastError()));
s_hBacklightReq = NULL;
}
}
}
출처: Program Applications to Turn the Smartphone Backlight Off and On (MSDN)
