精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。”需要全文内容也请联系孙老师。
默念学员开发公司产品时遇到分析网页内容的困难,在网页里有script脚本生成内容,这些内容通过WebBrowser找不到,也控制不了。我搜索后发现此开源实例能够解决困难。这个实例能够直接看到script脚本生成内容。
csEXWB is a C# .NET 2.0 control that creates, hosts and sinks the events of the original Webbrowser control (Not .NET or any other wrapper). Advanced customization and total control over the Webbrowser control are achieved via implementation of a number of interfaces, along with the addition of many methods, properties, events and a COM library. The control has no dependencies on MSHTML interop. All of the interfaces, enums and structs are defined within the project. Here are some of the features of this control:csEXWB是适用于.NET2.0平台(当然高级平台也是没问题的)的控件,它能够创建,加载和截获原形WebBrowser控件(非.NET或任何其它封装过的控件)有的事件。高级定制和总体控制通过一些接口可以实现,还提供很多方法、属性、事件和COM库。控件不依赖于MSHTML。所有接口,枚举和结构在工程内定义。下面是一些特性:
This is a basic class derived from Control class. It overrides a number of Control methods in order to create, host and dispose the Webbrowser control. In addition, it handles resize events and forwards keyboard, focus, refresh and visibility events to the hosted Webbrowser control.基类是Control。
csExWBDLMan is written in VC++ 6.0 using ATL 3.0. It is compiled with minimum dependencies, i.e. no MFC, std::, CString. The library is used to allow the client to employ the IDownloadManager implementation of csExWBDLMan library. In addition, the library implements the PassthroughAPP package by Igor Tandetnik, which enables the client to intercept all HTTP and HTTPS request and responses. The last functionality offered by the library is the ability to set any of the available windows hooks with the option to cancel a call. This functionality is used to stop dialogs launched using the showModelessDialog() and showModalDialog() methods. The library can be used in any other project that needs to set a global windows hook or view HTTP and HTTPS headers, as long as a valid window handle is supplied. csExWBDLMan开发平台为VC6和ATL3.0。依赖的东西少,不依赖MFC,std::和Cstring。库用来让客户端实施IdownloadManager。另外还实现了PassthroughAPP,它支持了所有HTTP和HTTPS的交互。
regsvr32.exe C:\windows\system32\csExWBDLMan.dll
Each interface mentioned below plays a role in either the hosting or customization process. I decided not to go through a detailed explanation of how to implement and use the interfaces. One can easily find all of the information regarding implementation and functionalities offered by these interfaces from MSDN, or right here on this site.
These methods are self explanatory
Note: In a frameset, the bTopLevel parameter determines whether to use the top level document or to attempt to find and use the active document
DocumentComplete has been modified to include an extra parameter, IsTopLevel, which indicates whether or not we have the top-level document.
To use internal drag drop functionality, RegisterForInternalDragDrop must be set to true (default)
FileDownloadExXXX events are activated by setting UseInternalDownloadManager property to true (default)
I have attempted to make the demo as comprehensive as possible. Here are some of its main features:
我们锐英源服务时关注了DOM的显示,通过加载网页后,点击菜单Tools->Document DOM获取网页源文件对应的标签信息,标签是按树形组织的,很容易理解。下面是百度的DOM信息窗口:
Although reasonable care has been taken to ensure the correctness of this implementation, expect bugs. This code should never be used in any application without proper verification and testing. When reporting bugs, sending suggestions or requests, or asking a question, please include information regarding IE and OS versions and service packs. Include as much detail as possible. This will be very helpful, not only for me to find and fix bugs or implement requested features, but for others who may be in a similar position.