实现由 WebBrowser 控件调用的 IDispatch::Invoke
我正在尝试执行他们在这篇文章中解释的操作在控制下载和执行
部分。据我了解,该上下文中的 Web 浏览器控件
不是 .NET 的 WebBrowser
。
我想做的是控制 WebBrowser
控件下载的内容。我一直在寻找这个,并且总是在 csEXWB
中找到,其中有一个我无法破译的巨大代码。
到目前为止我所做的是继承.NET的WebBrowser
,通过使用[ComVisible(true)]
属性使我继承的类com可见,将此方法添加到我的类中(取自 csEXWB):
[DispId(HTMLDispIDs.DISPID_AMBIENT_DLCONTROL)]
public int Idispatch_AmbiantDlControl_Invoke_Handler()
{
return (int)m_DLCtlFlags;
}
然后调用这行代码,其中 Browser
是我的派生类的实例:
IfacesEnumsStructsClasses.IOleControl oleControl = Browser.ActiveXInstance as IfacesEnumsStructsClasses.IOleControl;
oleControl.OnAmbientPropertyChange(IfacesEnumsStructsClasses.HTMLDispIDs.DISPID_AMBIENT_DLCONTROL);
所以我希望 oleControl
会调用我的Idispatch_AmbiantDlControl_Invoke_Handler
方法,但它没有。我不知道怎么做,这可能是我的代码所缺少的,oleControl
应该知道在哪个对象上调用我的 Idispatch_AmbiantDlControl_Invoke_Handler
方法。
我上面链接的文章说的是它将调用您的 IDispatch::Invoke
。 你的
是什么意思。我如何告诉 oleControl
哪个对象是我的 IDispatch
。希望我说得有道理。
I'm trying to do what they explain on this article in the Controlling Download and Execution
section. I understand the Web Browser Control
in that context is not .NET's WebBrowser
.
What I'm trying to do is to gain control over what the WebBrowser
control downloads. I've been searching for this a lot and always en up in the csEXWB
, which has a huge code that I just cannot decipher.
What I've done so far is inherit .NET's WebBrowser
, make my inherited class com visible by using the [ComVisible(true)]
attribute, add this method to my class (taken from csEXWB):
[DispId(HTMLDispIDs.DISPID_AMBIENT_DLCONTROL)]
public int Idispatch_AmbiantDlControl_Invoke_Handler()
{
return (int)m_DLCtlFlags;
}
And then call this line of code, where Browser
is an instance of my derived class:
IfacesEnumsStructsClasses.IOleControl oleControl = Browser.ActiveXInstance as IfacesEnumsStructsClasses.IOleControl;
oleControl.OnAmbientPropertyChange(IfacesEnumsStructsClasses.HTMLDispIDs.DISPID_AMBIENT_DLCONTROL);
So what I'm hoping is that the oleControl
will call my Idispatch_AmbiantDlControl_Invoke_Handler
method, which it doesn't. I don't know how, and this is probably what my code is missing, is the oleControl
supposed to know on which object to call my Idispatch_AmbiantDlControl_Invoke_Handler
method.
What the article I linked above says is it will call your IDispatch::Invoke
. What does it mean by your
. How do I tell oleControl
which object is my IDispatch
. Hope I'm making any sense.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个定制的 Web 浏览器,允许您更改 DLCONTROL 标志。
这是示例代码:
以及定制的 WebBrowser 代码:
Here is a customized WebBrowser that allows you to change the DLCONTROL flags.
This is an example code:
And the customized WebBrowser code: