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 檔。