我是为了抓数据用,所以不希望有图片和FLASH等东西,只需要网页文字和javascript文件下载就可以了。

解决方案 »

  1.   

    1. Code a class in C# that implements the IDispatch interface. You can either handcode the IDispatch interface declaration or use tlbimp on the .idl file that contains the definition for IDispatch.2. In the class implementation you need to do what the http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/hosting/wbcustomization.asp article says ie. respond to the paticular code and return a value which will disable images and scripting. Also for the constants like the ones below you will have to look up the header files and hand code the values of these constants.
    DLCTL_DLIMAGES, DLCTL_VIDEOS, and DLCTL_BGSOUNDS
    DLCTL_NO_SCRIPTS and DLCTL_NO_JAVA
    DLCTL_NO_DLACTIVEXCTLS and DLCTL_NO_RUNACTIVEXCTLS: 3 Now the tricky part is how to set this class as the host of the webbrowser control, if the control is the ActiveX version and by default the form in which you have hosted the webbrowser ActiveX control is the host then it is quite easy, simply make the Form implement IDispatch. If you use the .Net 2.0 WebBrowser class in Winform you will have to derive a class from WebBrowserSite AND IDispatch, override WebBrowser.CreateWebBrowserSiteBase() and return your a WebBrowserSite derived object in  WebBrowser.CreateWebBrowserSiteBase.