使用的枚举注册表类库跟"简单枚举本机BHO"一样,代码如下:
void ShowIEMenuList()
{
HKEY hKey = HKEY_CURRENT_USER;
vector< string > ListEnumKey;
std::string strFullName = "Software\\Microsoft\\Internet Explorer\\MenuExt";
EnumRegistryKey(hKey,strFullName,ListEnumKey);
char szValue[MAX_PATH];
DWORD dwLen = MAX_PATH - 1;
std::string strTemp;
if (ListEnumKey.size() > 0)
{
for (DWORD i=0; i<ListEnumKey.size(); i++)
{
dwLen = MAX_PATH - 1;
memset(szValue,0,MAX_PATH);
cout<<ListEnumKey[i].c_str();
strTemp = strFullName + "\\" + ListEnumKey[i];
if (RegCreateKey(HKEY_CURRENT_USER,strTemp.c_str(),&hKey) == ERROR_SUCCESS)
{
if (RegQueryValueEx(hKey,NULL,NULL,NULL,(LPBYTE)szValue,&dwLen) == ERROR_SUCCESS)
{
cout<<" "<<szValue;
}
RegCloseKey(hKey);
}
cout<<endl;
}
}
}