Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
I am looking for a way to tell a desktop from a laptop PC, by program. I know how to use the WMI API to query the machine about its hardware resources.

The question is what feature(s) can I detect to make this distinction in a simple and sufficiently reliable way ? I have two leads right now: 1) checking if the processor is of a mobile type, 2) detecting PCI slots.

Any suggestion welcome, thanks.
Posted
Comments
Aescleal 18-May-12 10:08am    
How about:

bool is_computer_laptop( std::ostream &output_stream, std::istream &input_stream )
{
output_stream << "Please unplug your computer from the mains or UPS\n"
<< "Press any character key when you have" << std::end;

char c; input_stream >> c;

return true;
}
YvesDaoust 18-May-12 10:15am    
How can I restart the application after the reboot to where it was interrupted, in case of a desktop?

 
Share this answer
 
Comments
YvesDaoust 17-May-12 6:08am    
Nice, thanks.

The MSDN topic is the most interesting: http://technet.microsoft.com/en-us/library/cc180825.aspx
Could you use either:
- Win32_Battery class[^]
- Win32_SystemEnclosure class[^] (ChassisTypes)
 
Share this answer
 
Comments
YvesDaoust 17-May-12 6:02am    
Cool, new leads !

Any idea about the availability/reliability of the info ?
Wendelius 17-May-12 6:14am    
Sorry but no idea about the reliability. I would guess that the battery is more reliable than chassis type.
YvesDaoust 17-May-12 6:14am    
That's also my feeling, thanks.
Wendelius 17-May-12 6:16am    
You're welcome :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900