QuickstartPretty simple: download the project, run it. See 'Adding the referenced ActiveX controls' if it doesn't compile from reference issues. IntroductionThe next version of the .NET framework features a comprehensive wrapper class for the Microsoft Web Browser control - a COM control that is used by IE and is embedded into Explorer. This new control features everything people are at pains to produce using COM without fishing through newsgroups and tech articles. Well, I thought it was about time there was an equivalent control for .NET 1.0 / .NET 1.1, so I've put my open-source apron on once more, to produce this control. This control contains the following features that you do not get (without doing it yourself) with the standard
In some ways, it's actually more feature-rich than the .NET 2.0 control, although the .NET 2.0 control features a security model implementation and a few other properties that will hopefully be put into How is it implemented?I'm not going to bother going into detail about how it's been implemented - there is a wealth of information out there on the net that explains this already. See the References section for links to the places I got the information from. The control is a user control with the IDocHostUIHandler and context menusThe control implements myBrowser.ContextMenu = new ContextMenu();
if you don't want the default IE context menu. In the version 2 control, there is an additional option to not show the the IE context menu. If there's enough demand for this, I'll add it in. The legend of the IDispatch_Invoke_HandlerThe control also implements I don't believe the .NET 2.0 control has these options available; hopefully someone at MS who has ties to .NET will read this and request that it's added in, as they're quite core features for the control. WebExecWBThe control features an easier to use Flags designerThe control implements Thierry Bouquain's designer flag editor for setting the options flags in the designer. It currently has all of its COM imports, interfaces and the flag designer editor in the single file. This makes the source a bit bulkier, but nothing that regions don't overcome. It also makes the control more self-contained in my view. XP Service Pack 2In XP Service pack 2, Microsoft has updated the MSHTML part of the browser so that you get more options in your Adding the referenced ActiveX controlsWhen you download the project, you might find the following references missing:
I haven't included these as they are operating system dependent. I'm running XP SP2, whilst you might be running Windows 2000, XP SP1 etc., so my DLLs will break with your operating system, if I included them. To add Microsoft.mshtml.dll is straight forward; click on the Add Reference in the project, and add the following: Adding Once that's added to your toolbox, add a temporary form to the WebBrowserEx project, drop it onto the form, and then remove it. This should add it to your references. Now, do a voodoo dance and compile, and hopefully all should be well. I haven't tried compiling without VS.NET, adding the references should be straight forward enough though, using the AxImp tool with SHDocVw.dll. DOM event handlingI've added support into the control for the MSHTML document events. The events allow you to capture keydown, mouseclick etc. events in the document - events which are not available to the browser control itself as it is just a host for the document parser. The implementation I've added is fairly experimental, and can be switched on usingEnableHtmlDocumentHandling property. Setting this to true will mean all
HtmlDocument* events are fired, however I should stress that these events tend to swallow up your key and mouse events and seem to make the form key presses and link clicking go screwy. I didn't have time to work out why this was, I'll probably have a look at it on a rainy Sunday.
And finallyThe method and property names in the control don't match those of the .NET 2.0 control. Some are the same, some aren't. I can't really see a scenario where you'd upgrade from this to the new .NET 2.0 control, but if this is a big problem with people, I can change it so that all the property names and methods are the same. One small touch I've added to the control is to include the documentation from MSDN for all of the events that come from That's all. I hope the control comes in useful. References
About smallguy78
|
Extended web browser control for .NET 1.0/1.1
最新推荐文章于 2024-09-02 17:33:58 发布