How to determine the computer type? A simple method is to query the win32_systemenclosure class Through WMI, and chassistypes indicates the computer type. There are 22 known types, which we usually cannot see. The most common types are desptop (3), laptop (9) (older models), and notebook (10 ).
The system. Management namespace must be referenced.
The following is the sample code:
Using system. Management;
Public Enum chassistypes
{
Other = 1,
Unknown,
Desktop,
Lowprofiledesktop,
Pizzabox,
Minitower,
Tower,
Portable,
Laptop,
Notebook,
Handheld,
Dockingstation,
Allinone,
Subnotebook,
Spacesaving,
Lunchbox,
Mainsystemchassis,
Expansionchassis,
Subchassis,
Busexpansionchassis,
Peripheralchassis,
Storagechassis,
Rackmountchassis,
Sealedcasepc
}
Public static chassistypes getcurrentchassistype ()
{
Managementclass systemenclosures = new managementclass ("win32_systemenclosure ");
Foreach (managementobject OBJ in systemenclosures. getinstances ())
{
Foreach (int I in (uint16 []) (OBJ ["chassistypes"])
{
If (I> 0 & I <25)
{
Return (chassistypes) I;
}
}
}
Return chassistypes. Unknown;
}
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/vrhero/archive/2007/11/08/1874042.aspx