• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 459
  • Last Modified:

C++ How to detect if a system is a PC, Laptop or Server

I'm writing a program which needs to know whether a system is a desktop PC, laptop or a server.  It does not have to be 100% but needs to be pretty accurate.  I can check for a server simply by looking at the OS so that's not a problem.  A laptop I thought I could detect using the GetSystemPowerStatus() call but looking on the Internet it seems this may be flaky.  Any suggestions how best to determine what type of computer the program is running on.  This needs to be standrad MFC code as I can't guarantee that .NET will be installed
0
ChrisMDrew
Asked:
ChrisMDrew
1 Solution
 
Gideon7Commented:
Look at the registry key HKEY_LOCAL_MACHINE\System\CurrentControl\Control\ProductionOptions, value ProductType
"WinNT" = Windows desktop OS (XP, Vista, etc)
"ServerNT" = Windows server OS (non-domain controller)
"LanmanNT" = Windows server OS (domain controller)
This works on all versions of Windows back to Windows NT.

There is no reliable way to detect a laptop AFAIK.  Many 'desktop replacement' laptops (like the Dell XMP) look just like desktops.  And many desktops have aggressive power-saving modes that look like laptops.
0
 
ChrisMDrewAuthor Commented:
Used part of this and also my own code which although not 100% does detect most laptops I have tested
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now