Windows Mobile 5.0 기기에서 백라이트 꺼지지 않도록 하기

프로그래밍/개발/Blackjack(SPH-M6200) 2007/10/18 02:48

Windows Mobile 용 프로그램은 자체 전원관리에 의하여 백라이트가 꺼지고 화면이 꺼지는 작동을 하게 된다.

만약 동영상 플레이어나 기타 프로그램을 만들 경우 백라이트가 꺼지지 않는 것을 원할 수 있는데, 다음과 같은 코드를 이용하면 된다.

//  IN BOOL fBacklightOn - TRUE to keep the backlight on.
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)
크리에이티브 커먼즈 라이선스
Creative Commons License


Trackback 0 : Comment 0

Trackback Address :: http://blog.nworkers.net/trackback/199 관련글 쓰기

Write a comment

◀ PREV : [1] : ... [13] : [14] : [15] : [16] : [17] : [18] : [19] : [20] : [21] : ... [198] : NEXT ▶