我试图在本节中对这篇文章进行解释Controlling Download and Execution.我理解Web Browser Control上下文不是.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;
}
Run Code Online (Sandbox Code Playgroud)
然后调用这行代码,其中Browser是我的派生类的实例:
IfacesEnumsStructsClasses.IOleControl oleControl = Browser.ActiveXInstance as IfacesEnumsStructsClasses.IOleControl;
oleControl.OnAmbientPropertyChange(IfacesEnumsStructsClasses.HTMLDispIDs.DISPID_AMBIENT_DLCONTROL);
Run Code Online (Sandbox Code Playgroud)
所以我希望的是,这oleControl将会调用我的Idispatch_AmbiantDlControl_Invoke_Handler方法,而不是.我不知道怎么样,这可能是我的代码丢失的原因,oleControl应该知道调用我的Idispatch_AmbiantDlControl_Invoke_Handler方法的对象.
我上面链接的文章说的是it will call your IDispatch::Invoke.它是什么意思your.我怎么知道oleControl哪个对象是我的IDispatch.希望我有任何意义.