我正在构建一个IE插件,我想“是”外部对象。因此我使用SetUIHandler将我的类设置为UIHandler。AddFavorite在c#中实现IShellUIHelper时不工作#
我执行的IDocHostUIHandler(引用到Microsoft Internet控件(COM对象)),并在GetExternal我回到我的课:
public void GetExternal(out object ppDispatch)
{
ppDispatch = this;
}
这个伟大的工程。任何其他选项都不是我感兴趣的,所以我需要返回E_NOTIMPL。
例如:
public void TranslateAccelerator(ref tagMSG lpmsg, ref Guid pguidCmdGroup, uint nCmdID)
{
Marshal.ThrowExceptionForHR((int)WinAPI.HRESULT.E_NOTIMPL);
}
的伟大工程,但我也需要实现IShellUIHelper(IE指望它从UIHandler)。
,然后当我实现添加到收藏夹:
public void AddFavorite(string URL, ref object Title)
{
Marshal.ThrowExceptionForHR((int)WinAPI.HRESULT.E_NOTIMPL);
}
它不工作(js的获得和错误)。
当我试图做同样的在C++,并返回E_NOTIMPL为返回值,一切都很正常:
STDMETHODIMP CMyClass::AddToFavoritesBar(BSTR URL, BSTR Title, VARIANT *Type)
{
return E_NOTIMPL;
}
我也试图与throw new COMException("", (int)WinAPI.HRESULT.E_NOTIMPL);
更换Marshal.ThrowExceptionForHR((int)WinAPI.HRESULT.E_NOTIMPL);
,它仍然不起作用。
任何人都可以帮助我吗?
感谢,
欧米
抛出NotImplementException,它将转换为E_NOTIMPL。 –
这不起作用 – Omri