First we know that the difference between a desktop and a laptop is whether it has a power supply
If the API that reads the power information provides a return value, is it possible to conclude that it is a laptop or a desktop computer?
Let's look at an API
GetSystemPowerStatus function
We can generally know
This is a function of retrieving the power state of the system, which indicates whether the system is DC or AC, and the current load of the battery is emptied and so on.
Let me take a look at the parameters:
System_power_status
We can see batterflag this member, he loaded the battery status and included the logo
When the value is 128 and 255, the reaction is no voltage or read voltage,
So you can hit the following code:
#include <Windows.h> #include <stdio.h> int main () { system_power_status A; GetSystemPowerStatus (&a); if (A.batteryflag = = && A.batteryflag = = 255) { printf ("desktop computer \ n"); } else { printf ("Portable computer \ n"); } return 0; }
Operation Result:
The above is the C/s + + judgment is the content of notebook computer, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!