开发者

Tracking activity in a WebBrowser control from a Windows Form Host

Disclaimer: I'm asking on behalf of a client, and have not witnessed this issue first hand. He has a third party app that produces training media, which his training application presents in a WinForms app through the WebBrowser control.

The interfaces he has been able to access on the WebBrowser control, on the surface of things, don't expose all the information required by the host form to fully integrate with the web appl开发者_如何学运维ication, which is a bit more advanced than basic HTML. He would like to e.g. detect a button click, and information on the state of the web app when that click takes place.

If more is possible that we know with the WebBrowser, please suggest some areas to explore. Otherwise, is there any alternative to the WebBrowser control? Anything from Mozilla that can be hammered into looking like a windows form control but without being so proprietary?


If you're using an IE control then you can do pretty much anything you want using the HTML object library: msmhtl.dll. You can hook into the IE control and access the DOM, intercept all events and even programmatically intercept the HTML and change it on the fly. But, this is a huge topic.

Here's a link to a demo VB app:

http://www.codeproject.com/KB/vb/kirangoka.aspx?msg=2587205

Google on mshtml and shdocvw and you should find a number of interesting examples.

Alternatively, take a look at WatiN.


i have no idea about "all the information required by the host". I guess it is specific to the web site. The web site needs to expose the information in a predictable way, such as giving the elements ids for easy access.

You may want to redesign the web site and expose some APIs via web service. Using a browser for HTML Parsing isn't a very reliable and scalable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜