简单枚举IE右键菜单

来源:互联网 发布:钢铁雄心4 意大利 知乎 编辑:程序博客网 时间:2024/05/01 13:42

使用的枚举注册表类库跟"简单枚举本机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;
        }
    }
}

原创粉丝点击