views:

299

answers:

3

I am writing a desktop app in VB.Net, and I'd like to include a web browser control to automate certain functions the user might have to perform in the browser. I have to render the page so I do not want to use the webrequest to make direct calls. When I publish the app, do I have to be concerned with which version of Internet Explorer the user has on their machine? Are their any third party, freely available, stable web browser controls available for VB.Net that people are using?

+1  A: 

Several versions of Visual Studio support web browser controls. Here is an article on how to implement one.

http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx

The web browser control will work with different versions of Internet Explorer, but will be limited to the functionality supported by that version of Internet Explorer.

The article is based on Visual Studio 2008, but in the right corner of the article there are links, on how to use the web browser control, to earlier versions of Visual Studio.

Joe Pitz
Thanks for the link. My biggest concern is publishing this app to 500 users and having no control over what version of IE they have.
ajl
+4  A: 

You could always ignore the whole IE issue and use the Mozilla engine embedded in your app:

geckofx

"An open-source component for embedding Mozilla Gecko (Firefox) in .NET applications."

http://code.google.com/p/geckofx/

Paul Kohler
Looks pretty good. Anyone know of a VB.Net project using geckofx?
ajl
but its .net - it doesn't matter (well, almost always!) Reflector is your friend...
Paul Kohler
Wouldn't this mean you're now responsible for rolling out patches to the Mozilla engine to your users? Security hotfixes etc?
MarkJ
I think I am OK with this because I am going to control the sites they visit 100% - as long as the program doesn't bomb when they upgrade firefox it should be good.
ajl
I literally got this working in VB.Net in 3 minutes. Looks a ton like the IE webbrowser control. Thanks Paul!!!
ajl
No worries! BTW - keep in mind that you are controlling the deployed DLL's (i.e. make sure you include them in your deployment artifacts etc)
Paul Kohler
+1  A: 

If you embed the Webbrowser control in your application, what you're really doing is embedding a COM object. At runtime, your app will CoCreateInstance() the Webbrowser control, which will load it out of the version of SHDOCVW.DLL or IEFRAME.DLL that is currently on the machine. So, in plain English, you'll be getting the IE6, IE7 or IE8 Webbrowser control, depending on what is installed on the machine.

The practical differences, however, are minimal since the interfaces were published a long time ago and haven't changed over those versions. Differences in terms of different commands that some interfaces (such as IOleCommandTarget) support are abstracted away by the managed layer anyway, so you don't have to worry about that. The biggest difference will be rendering differences, since there is a huge delta in CSS conformance between IE6 and IE8. You'll have to test the various versions using Microsoft's app compat VHDs.

When I worked on the IE team application compatability wrt the Webbrowser control was a huge deal; the team works very hard to make sure that behavior doesn't regress for precisely this scenario—the custom enterprise VB app hosting the WebOC.

Though if you decide to go with an open-source solution to distribute with your app, may I suggest WebKit? Its layout engine is very good and the source code is pretty well maintained and easy to read, though you'll have to write your own managed hosting layer. The Gecko code is much harder to read and debug.

jeffamaphone