zoukankan      html  css  js  c++  java
  • Wince系统版本信息函数、电池信息函数


    	OSVERSIONINFO osInfo;
    	GetVersionEx(&osInfo);
    	printf("os: major=%d,minor=%d,buildno=%d,platformId=%d,CSDVer=%ls\n",
    		osInfo.dwMajorVersion,osInfo.dwMinorVersion,
    		osInfo.dwBuildNumber,osInfo.dwPlatformId,osInfo.szCSDVersion);
    	//work  os: major=6,minor=0,buildno=3122,platformId=3,CSDVer=
    	//模拟器os: major=6,minor=0,buildno=0,platformId=3,CSDVer=
    
    	TCHAR szPlat[256];
    	SystemParametersInfo(SPI_GETPLATFORMTYPE,sizeof(szPlat),szPlat,0);
    	printf("szPlatTyep = %ls\n",szPlat);//szPlatTyep = DeviceEmulator
    
    	SystemParametersInfo(SPI_GETOEMINFO,sizeof(szPlat),szPlat,0);
    	printf("szOEM = %ls\n",szPlat);//szOEM = Microsoft DeviceEmulator
    
    	SystemParametersInfo(SPI_GETPROJECTNAME,sizeof(szPlat),szPlat,0);
    	printf("szProcName = %ls\n",szPlat);
    	//wrok:szProcName = Unknown WinCE Project
    	//模拟器:szProcName = CEBase
    	SystemParametersInfo(SPI_GETPLATFORMNAME,sizeof(szPlat),szPlat,0);
    	printf("szPlatName = %ls\n",szPlat);//szPlatName = DeviceEmulator
    
    	SystemParametersInfo(SPI_GETBOOTMENAME,sizeof(szPlat),szPlat,0);
    	printf("szBootName = %ls\n",szPlat);//szBootName = DeviceEmulator
    
    	SystemParametersInfo(SPI_GETPLATFORMMANUFACTURER,sizeof(szPlat),szPlat,0);
    	printf("szPlatManu = %ls\n",szPlat);//szPlatManu = DeviceEmulator
    
    	SystemParametersInfo(SPI_GETUUID,sizeof(szPlat),szPlat,0);
    	printf("szUUID = %ls\n",szPlat);//szUUID = DeviceEmulator
    
    	SystemParametersInfo(SPI_GETGUIDPATTERN,sizeof(szPlat),szPlat,0);
    	printf("szGuid = %ls\n",szPlat);//szGuid = 
    

      

    	SYSTEM_POWER_STATUS_EX2 power = {0};
    
    	if(0==GetSystemPowerStatusEx2(&power,sizeof(SYSTEM_POWER_STATUS_EX2),TRUE))
    		printf("调用失败\n");
    	else
    	{
    		if(AC_LINE_ONLINE==power.ACLineStatus)
    			printf("系统在交流电源下\n");
    		if (BATTERY_FLAG_HIGH == power.BatteryFlag)
    			printf("电池电量全满或接近全满\n");
    		printf("电池电量剩余百分比=%d\n",power.BatteryLifePercent);
    		printf("电池还能维持%X\n",power.BatteryLifeTime);
    		printf("电池充满可以维持%X\n",power.BatteryFullLifeTime);
    		//#define BATTERY_LIFE_UNKNOWN        0xFFFFFFFF
    		printf("电池类型=%X\n",power.BatteryChemistry);
    	}
    
    系统在交流电源下
    电池电量全满或接近全满
    电池电量剩余百分比=100
    电池还能维持FFFFFFFF
    电池充满可以维持FFFFFFFF
    电池类型=4
    

      

  • 相关阅读:
    浅谈Eclipse中maven的搭建
    sdk的相关知识以及浅谈手机模拟自动化
    java开发环境搭建
    Python学习————反序列化器(复习)
    Python学习————序列化器(复习)
    Python学习————jwt
    Python学习————对称加密和非对称加密
    Python学习————drf(七)
    Python学习————集群和分布式
    Python学习————drf(六)
  • 原文地址:https://www.cnblogs.com/ezhong/p/2171450.html
Copyright © 2011-2022 走看看