HKEY hKey;
DWORD dwType = REG_SZ;
DWORD dwSize = 255;//须指定长度,否则第一次读取RegQueryValueEx不成功,仅返回长度
TCHAR data[MAX_PATH];
bool ret;
if (RegOpenKey(HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), &hKey) == ERROR_SUCCESS)
TRACE(_T("open success"));
ret = RegQueryValueEx(hKey, _T("ProductName"),NULL,&dwType,
(LPBYTE)data,&dwSize) == ERROR_SUCCESS;
CString strWinVerName = data;
AfxMessageBox(strWinVerName);
RegCloseKey(hKey);
当前标题:获取Windows操作系统版本名称
标题URL:
http://kswsj.cn/article/pgdecj.html