您的位置:首页 > 其它

判断是笔记本还是台式机

2013-12-17 11:04 513 查看
bool checkIsLaptopOrPC() 
{ 
	SYSTEM_POWER_STATUS sps; 
	GetSystemPowerStatus(&sps); 

	if(sps.BatteryFlag == 128 && sps.BatteryLifePercent > 100)
		return true;// BatteryLifePercent == 255% 是PC
	else
		return false; 
}


用电源判断是比较靠谱的

笔记本电源<=100%

#include <stdio.h>

#include <windows.h>

#include <setupapi.h>

#include <devguid.h>

#include <regstr.h>

#include <stdio.h>

#include <string>

#include "tchar.h"

#pragma comment(lib,"setupapi.lib")
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: