使用C+检索设备型号名称+;在windows桌面上 我想知道如何用C++来检索设备模型。例如,如果我有一台戴尔笔记本电脑来检索类似“studio 1534”或类似的内容。
我已经结束了执行此代码:使用C+检索设备型号名称+;在windows桌面上 我想知道如何用C++来检索设备模型。例如,如果我有一台戴尔笔记本电脑来检索类似“studio 1534”或类似的内容。,c++,windows,C++,Windows,我已经结束了执行此代码: // Retrieve the device model from the Registry HKEY hKey; char buf[255] = { 0 }; DWORD dwType = 0; DWORD dwBufSize = sizeof(buf); try { if (RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("HARDWARE\\DESCRIPTION\\S
// Retrieve the device model from the Registry
HKEY hKey;
char buf[255] = { 0 };
DWORD dwType = 0;
DWORD dwBufSize = sizeof(buf);
try
{
if (RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("HARDWARE\\DESCRIPTION\\System\\BIOS"), &hKey) == ERROR_SUCCESS)
{
dwType = REG_SZ;
if (RegQueryValueEx(hKey, TEXT("SystemProductName"), NULL, NULL, (LPBYTE)buf, &dwBufSize) == ERROR_SUCCESS)
{
setDeviceModel(String(buf));
}
RegCloseKey(hKey);
}
}
catch (...) {}
看看这个,这需要Wbemidl.h,它需要WindowsVista或更高版本,还有XP的东西吗?