windows 调用 IWebBrowser2->get_Document 时出现错误 800706B5

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1427370/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:08:24  来源:igfitidea点击:

Error 800706B5 when calling IWebBrowser2->get_Document

c++windowsinternet-explorercomwindows-vista

提问by Simon Stewart

On Vista using IE8, I have an instance of IWebBrowser2, which I am using to obtain the current HTML document:

在使用 IE8 的 Vista 上,我有一个 IWebBrowser2 实例,我用它来获取当前的 HTML 文档:

IWebBrowser2* browser;
CComPtr<IDispatch> disp;
HRESULT hr = browser->get_Document(&disp);

When this is executed by an Administrator, the call succeeds. However, when called by a regular user, the call returns an error code of "800706B5" ("The interface is unknown") despite the page being on a "Trusted Site" and "Protected Mode" being off.

当管理员执行此操作时,调用成功。但是,当由普通用户调用时,尽管页面位于“受信任站点”且“保护模式”已关闭,但调用仍会返回错误代码“800706B5”(“接口未知”)。

This same code worked without problems on IE7 on Vista, and with IE8 on XP.

同样的代码在 Vista 上的 IE7 和 XP 上的 IE8 上都没有问题。

Does anyone know why this error might be occurring, and what I can do to resolve the issue? Running as administrator is less than ideal, and Jon Skeet is stumped by this one too :)

有谁知道为什么会发生这个错误,我可以做些什么来解决这个问题?以管理员身份运行不太理想,Jon Skeet 也被这个难住了:)

Update: the question seems to revolve around UAC: turning off UAC completely allows things to work for a regular user (though it's distinctly unsafe)

更新:问题似乎围绕着 UAC:完全关闭 UAC 可以让普通用户正常工作(尽管它显然不安全)

回答by Simon Stewart

The error is occurring because on Vista, IE 8 runs in "low integrity" mode, whereas my test code, running as a normal user, runs at "medium integrity". The security model is designed so that code can send instructions to lower integrity components, but data cannot be read from "lower" to "higher" components by default.

发生错误是因为在 Vista 上,IE 8 以“低完整性”模式运行,而我的测试代码以普通用户身份运行,以“中等完整性”运行。安全模型的设计使得代码可以向完整性较低的组件发送指令,但默认情况下无法从“较低”组件向“较高”组件读取数据。

More information is available in this document about How the Integrity Mechanism Is Implemented in Windows Vista

本文档中提供了有关如何在 Windows Vista 中实施完整性机制的更多信息

回答by Paul Mitchell

Was IE8 installed by the Administrator "For this user only"? I don't know why or if that would give this error, just a hunch.

IE8 是否由管理员“仅限此用户”安装?我不知道为什么或是否会出现此错误,只是一种预感。