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
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ezhong的博客签名-------------------------------------
以上内容来自ezhong的博客园,作者:ezhong
ezhong的博客园: http://www.cnblogs.com/ezhong
感谢您的阅读。感谢您的分享。