Set the Default Search Engine Provider of IE with IOpenServiceManager::InstallService

末鹿安然 提交于 2019-12-03 16:56:16
codewarrior

Use absolute path and UrlCreateFromPath to create a file:/// like URL, pass that URL to InstallService.

Between, it seems that your XML has error.

            WCHAR szURL[MAX_PATH] = L"";
            DWORD cchURL = ARRAYSIZE(szURL);
            hr = ::UrlCreateFromPath(argv[2], szURL, &cchURL, 0);
            if (SUCCEEDED(hr))
            {
                hr = spManager->InstallService(argv[2], &spService);

                // Now we can set it as the default.
                if (SUCCEEDED(hr))
                {
                    hr = spService->SetDefault(TRUE, NULL);
                    if (hr == OS_E_CANCELLED)
                    {
                        hr = E_ACCESSDENIED;  // by the user!
                    }
                }
            }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!