CString strPath="HARDWARE//DESCRIPTION//System"; CRegKey regkey;//定义注册表类对象 LONG lResult;//LONG型变量-反应结果 //打开注册表键 lResult=regkey.Open(HKEY_LOCAL_MACHINE,LPCTSTR(strPath),KEY_ALL_ACCESS); if (lResult!=ERROR_SUCCESS) { AfxMessageBox("错误:无法查询有关的注册表信息"); return; } char chVideoBiosDate[50]; DWORD dwSize=50; regkey.QueryValue((char*)chVideoBiosDate,"VideoBiosDate",&dwSize);//获取 //VendorIdentifier字段值 m_strDate=chVideoBiosDate; UpdateData(FALSE); regkey.Close();//关闭注册表
转载:http://hi.baidu.com/_ynbg/blog/item/142100ec89d9814279f055c2.html
本文介绍了一个使用C++编程语言从Windows注册表中读取特定键值的例子。通过定义注册表类对象并调用相关函数来打开指定路径的注册表项,然后查询并获取VideoBiosDate字段的值。
841

被折叠的 条评论
为什么被折叠?



