4

How can i stop the webbrowser from loading/displaying images, flash, script etc?

I found this article that deals with it, but i dont know how to implement that "STDMETHODIMP CAtlBrCon::Invoke" function

This is the link:article

Can anyone point me into the right direction?

Yustme
  • 6,125
  • 22
  • 75
  • 104

1 Answers1

1

The process is like this:

The control calls the webbrowser's IOleControl.OnAmbientPropertyChange implementation in the SynchDOCDOWNLOADCTLFLAG function in http://csexwb2.googlecode.com/svn/trunk/cEXWB.cs to notify the webbrowser control about a change in ambient properties inside the ActiveX host.

The the webbrowser control then calls its host's IDispatch.Invoke implementation to query for the updated download control flag.

The host's IDispatch.Invoke implementation for the DISPID_AMBIENT_DLCONTROL dispid looks like this

[DispId(HTMLDispIDs.DISPID_AMBIENT_DLCONTROL)] public int Idispatch_AmbiantDlControl_Invoke_Handler() { return (int)m_DLCtlFlags; }

Check Controlling Download and Execution to see the list of flags you can use to change the behavior of the browser.

Sheng Jiang 蒋晟
  • 15,125
  • 2
  • 28
  • 46
  • 2
    But where does he do webbrowser += "Idispatch_AmbiantDlControl_Invoke_Handler" ? i've been spitting in that code for a week or 2. its too complicated. Can't backtrace anything there. – Yustme Aug 10 '10 at 07:23
  • How does the browser 'know' to call IOleControl.OnAmbientPropertyChange ? How is one thing attached to another? – Yustme Aug 11 '10 at 12:16
  • It is documented at http://msdn.microsoft.com/en-us/library/aa753622(VS.85).aspx. – Sheng Jiang 蒋晟 Aug 11 '10 at 17:22
  • I'll give this a try again. I was wondering what do i need to add in my reference for this to work? – Yustme Oct 20 '10 at 09:54
  • or just build csexwb and set its WBDOCDOWNLOADCTLFLAG property – Sheng Jiang 蒋晟 Oct 20 '10 at 15:14
  • I did, but that control has a lot of problems. I have to close it every 15 minutes because it 'grows'. Mem leakage. All i need anyway is to control the downloads. – Yustme Oct 20 '10 at 20:31
  • You can write your own code using the source code of csexwb as the reference. But I doubt you can get much better performance. IE does not aggressively break circular reference created by javascript until IE8. – Sheng Jiang 蒋晟 Oct 21 '10 at 16:30