0

新しい IE 検索エンジンを定義しようとしていますが、サービスをインストールしようとするたびに問題が発生します。

次のを見て、ファイルの名前のみを変更しました

アップロード.xml:

 <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
   <ShortName>Web Search</ShortName>
   <Description>Use Example.com to search the Web.</Description>
   <Tags>example web</Tags>
   <Contact>admin@example.com</Contact>
   <Url type="application/rss+xml" 
        template="http://example.com/?q={searchTerms}&amp;pw={startPage?}&amp;format=rss"/>
 </OpenSearchDescription>

home.html

<html>
    <header>
        <link rel="search"
               type="application/opensearchdescription+xml" 
               href="http://somesite.com/upload.xml"
               title="Content search" />
    </header>
</html>

リンクは有効で機能します。

c++:

ATL::CComPtr<IOpenServiceManager> spManager;
if (FAILED(hr = spManager.CoCreateInstance(CLSID_OpenServiceManager)))
    return false;

//URL-OF-SERVICE: See http://www.opensearch.org/Specifications/OpenSearch/1.1#OpenSearch_description_elements 
ATL::CComPtr<IOpenService> spService;
if (FAILED(hr = spManager->InstallService(L"http://somesite.com/home.html", &spService)))
    return 0;

if (FAILED(hr = spService->SetDefault(TRUE, nullptr)))
    return 0;

return 1;

私が得るサービスをインストールしようとするたびに (hr = 0xc00ce556 / E_INVALIDARG)

4

1 に答える 1

0

ActiveX/COM は、(クラスによってラップされた) 関数ファミリのBSTR文字列を使用します。を介してコンパイル時のリテラルの代わりにそれを使用してみてください:SysAllocString()CComBSTRWCHAR[]L"..."

BSTR url = SysAllocString(L"http://somesite.com/home.html");
spManager->InstallService(url, &spService)
SysFreeString(url);

CComBSTR url(L"http://somesite.com/home.html");
spManager->InstallService((BSTR)url, &spService)
于 2015-06-29T19:17:48.300 に答える