We use WEBKit instead of IE in Visual Basic.net applications.
Epilogue
For a long time I was looking for a solution to this problem, until yesterday, purely by chance, I came across one site where I described how to do this in C #.
Not long after thinking, I tried to do it in Visual Basic.net and about a miracle, I will no longer see the annoying IE window in my small programs.
I’ll say right away that I’m far from a programmer myself, this is just a hobby for this article written for beginners.
Advanced programmers will not see anything new.
Start
To get started, start
Visual Studio and create a new
windows forms project in
Visual Basic .
We do not change anything at all, we save the entire project in the default folder.
I have:
C: \ Users \ Jey \ Documents \ Visual Studio 2012 \ ProjectsNow go to the website
webkitdotnet.sourceforge.net(You should pay attention to the license information of the library, at the bottom of the page it says “WebKit .NET is licensed under the
BSD open source license.” As far as I understand English, this means we can use both the finished component and the source code with the obligatory indication of the author
go to the
Downloads section, click on the
Win32 Binary linkYou will be transferred to the download page where you need to wait a bit and the archive will start loading,
in my case, it was called WebKit.NET-0.5-bin-cairo.zip
Find the BIN folder in the archive and unpack it into the Debug folder in the bin folder in the project directory, in
my case is "C: \ Users \ Jey \ Documents \ Visual Studio 2012 \ Projects \ WebKit \ WebKit \ bin \ Debug".
Remove from there WebKitBrowserTest.exe is an already assembled test browser.
U-turn
Switch windows back to Visual Studio on the right (by default) in the toolbar we click the right
with the mouse button, and select the Select elements in the pop-up menu that appears. The “Selection
of the elements of the elements panel ”(Melkomyagkaya tautology). On the tab Components NET.Framework (open by default)
click the browse button, and from the folder where you unzipped the archive, select WebKitBrowser.dll in my case the path to
the library was:
"C: \ Users \ Jey \ Documents \ Visual Studio 2012 \ Projects \ WebKit \ WebKit \ bin \ Debug \ WebKitBrowse r.dll".
Now in the toolbar under the usual WebBrowser will also be WebKitBrowser.
Well, for example, throw it on the form:
And on top of the form for prettiness you can throw a ToolStrip and place four buttons and a Textbox on it.
In the WebKitBrowser1 properties we find the Anchor property and write the value "
Top, Bottom, Left, Right ". This will allow the window
the browser will automatically scale to the surrounding elements (in our case, on the sides and bottom of the curb
form and ToolStrip menu on top) when resizing the form.
And now it all looks like this:
Write the code for the buttons:
')
Compile and enjoy your WebKit browser.
Screenshot from habrahabr.ru Conclusion
When compiling, for example, in the release configuration, Visual Studio will automatically transfer the WebKitBrowser.dll library to the appropriate directory, but this will not be enough to run, at least my browser has not started. This suggests that you need to carry the rest of the contents of the bin folder from the archive with the component. And in confirmation of this in the archive there is a README.TXT in which it is written:
... This package contains the binary release of WebKit.NET, along with
the Cairo build of WebKit. Files included in this release include:
bin / WebKit.dll - The WebKit library.
bin / WebKitBrowser.dll - The WebKit.NET control library. Add a reference to
this is a library.
bin / WebKit.Interop.dll - The library WebKit.NET uses to interface to WebKit
via COM interop.
bin / WebBrowserTest.exe - A simple application demonstrating the use of the
WebKit.NET control.
bin / *. dll - Dependencies required by WebKit.dll.
docs / WebKit .NET API Reference.chm - API reference in CHM format ...
Now the difference between using IE and WebKit.net
If you use IE (no matter what version), then the size of the finished .exe will be minimal, no more than 40 kb. But we remember that IE is not really in the program but in the OS, and therefore if it does not work in the OS for some reason, it can also stop in the program.
If WebKit.net, then the size of the folder with the program and with all the necessary DLL will be more than 30 MB.
The difference is enormous? Well, I do not know, in the century when the movie can be 100 GB in size?
As you know, IE does not know how to work with js scripts (it doesn’t work, but it doesn’t). WebKit perfectly displayed without error those pages where IE spilled errors.
I haven’t yet managed to test the other engines listed in the comments, but I’ll definitely try if I’ll figure it out, of course, you remember, I’m just learning.