程序判断用户电脑是笔记本还是台式机

来源:互联网 发布:windows发送syslog 编辑:程序博客网 时间:2024/04/28 07:37

1.项目背景

想统计下安装公司软件的用户中台式机和笔记本的比例,操作系统的比例

2.解决方案

可以根据笔记本有备用电源,台式机没有来简单判断,不过存在误差

3.代码示例

#include <windows.h>#include <stdio.h>int main(int argc, char* argv[]){    SYSTEM_POWER_STATUS sps;    GetSystemPowerStatus(&sps);    if (sps.BatteryFlag != 128)        printf("lap-top computer\n");    else        printf("It could be a desktop or a laptop computer.\n");    system("pause");    return 0;}

4.存在缺陷

一旦将笔记本的备用电池去掉可能就无法确定是笔记本还是台式的了,还需要改进

0 0