다음을 통해 공유


플랫폼이 모바일인지 데스크톱인지 확인

TMM은 모바일 컴퓨터에서만 실행되며 데스크톱 컴퓨터에서 자동으로 비활성화됩니다. 하드웨어 공급업체는 자체 독점 메서드를 사용하도록 설정하고 사용하여 데스크톱 컴퓨터에서 복제 보기를 입력해야 합니다. 모바일 컴퓨터에서 복제 보기를 입력하고 대신 TMM을 사용하기 위해 독점 메서드를 사용하지 않도록 플랫폼이 모바일인지 확인해야 합니다.

하드웨어 공급업체는 다음 코드를 사용하여 플랫폼이 모바일인지 데스크톱인지 확인할 수 있습니다. 그런 다음 플랫폼은 적절한 메커니즘을 사용하여 복제 보기를 입력할 수 있습니다.

#include <Powrprof.h>   // For GetPwrCapabilities

    BOOL IsMobilePlatform()
    {
        BOOL fIsMobilePlatform = FALSE;

        fIsMobilePlatform = (PlatformRoleMobile == PowerDeterminePlatformRole());

        POWER_PLATFORM_ROLE iRole;

        // Check if the operating system determines 
        // that the computer is a mobile computer.
        iRole = PowerDeterminePlatformRole();

        if (PlatformRoleMobile == iRole)
        {
            fIsMobilePlatform = TRUE;
        }
        else if (PlatformRoleDesktop == iRole) 
        // Can happen when a battery is not plugged into a laptop
        {
            SYSTEM_POWER_CAPABILITIES powerCapabilities;

            if (GetPwrCapabilities(&powerCapabilities))
            {
         // Check if a battery exists, and it is not for a UPS.
         // Note that SystemBatteriesPresent is set on a laptop even if the battery is unplugged.
                fIsMobilePlatform = ((TRUE == powerCapabilities.SystemBatteriesPresent) && (FALSE == powerCapabilities.BatteriesAreShortTerm));
            }
            // GetPwrCapabilities should never fail 
            // However, if it does, leave fReturn == FALSE.
        }

        return fIsMobilePlatform;
    }

이전 코드에서 호출되는 함수에 대한 자세한 내용은 Microsoft Windows SDK 설명서를 참조하세요.