1 Attachment(s)
MS Edge WebView2 ActiveX wrapper
Hi,
Over the past weeks I've built an ActiveX wrapper for the Microsoft Edge WebView2 control, which is the follow up for the old cComWebBrowser control from Microsoft.
Quite a bit of its functionality is already available in my control, although I am still working on some of the nitty gritty. It is a huge interface and it will take some time to complete. Not all of it is exactly straight forward either.
The C++ Documentation is here:
[URL]https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/?view=webview2-1.0.864.35[/URL]
However much of what I did has been modeled after the .net interface.. (it is easier to navigate if you ask me)
[URL]https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core?view=webview2-dotnet-1.0.864.35&viewFallbackFrom=webview2-1.0.864.35[/URL]
I have been building against the very latest version of the control and have indeed already benefited from access to the latest features.
What I'm not sure about is what the interest for this is in the DataFlex community.
Just to be clear upfront, it won't be free as then I cannot provide any support on it.
In fact for price, it will be very similar to how Chilkat does its licensing and support.
Price will be similar too (EUR 300), although there will be an early bird deal with 50% off.
I expect to have an early beta demo ready in the next few days (need to write more DataFlex code etc.. test test test)
[ATTACH=CONFIG]14697[/ATTACH]
Let me know if there's any interest.
--
Wil
Re: MS Edge WebView2 ActiveX wrapper
Hi Wil
Assuming there is screen scraping and automation (setting form values, pressing buttons).
Than yes, seems a fair value!
Re: MS Edge WebView2 ActiveX wrapper
Hi Wil
Currently I don't use any browser objects (any more) so 300 EUR is a bit rich for me with no need. HOWEVER, I would likely be interested in the early bird special to keep my option open on this. Are you suggesting that there is an annual fee afterwards for licensing and support?
Mike
Re: MS Edge WebView2 ActiveX wrapper
Mike,
[QUOTE=Mike Cooper;366315]Are you suggesting that there is an annual fee afterwards for licensing and support?[/QUOTE]
No additional licensing fees or constraints beyond the expected "reselling" limit. Also no built in end dates on the control once purchased.
For support and updates there will indeed be a 1 year limit where you have to buy a new update&support after 1 year.
Not the "forever" updates option that I tend to do for other things.
The reasoning here is that for Microsoft the MS Edge WebView2 control is a work in progress.
They will keep on improving the control and this way I can keep up with their improvements.
Old versions should keep on working. That's a basic premise in ActiveX, they can add & extend, but normally not break old interfaces.
At least that is what Microsoft tells us about ActiveX technology.
As the underpinnings are based on ActiveX, I hope that Microsoft lives by their own rules.
edit: To be more clear. With the early bird special you will get updates for 1 year. So you can take advantage of any new features & fixes implemented in that one year subscription. If you then let lapse the update&subscription you still have a fully functional WebView2 browser control.
Marco: I will answer your question later today.
--
Wil
Re: MS Edge WebView2 ActiveX wrapper
Re: MS Edge WebView2 ActiveX wrapper
Marco,
[QUOTE=Marco;366308]Hi Wil
Assuming there is screen scraping and automation (setting form values, pressing buttons).
Than yes, seems a fair value![/QUOTE]
Ah.. an easy question from Marco.. with a long answer...
Define screen scraping. I think I know what you are asking, but it can be a picture, or the html that comes from the server, or it can be what is rendered in the browser (eg. the source might have been - is even likely to have been - changed via javascript). For my answer here I'm going to assume it is the latter.
Let's step back a bit.
With the old webBrowser activex control from Microsoft you would get direct access to the DOM from within the browser control and thus DataFlex.
Eg. there's the ComDocument function that returns variant variable that you can then connect to a cComHtmlDocument object via the mshtml ActiveX interface.
This was very powerful and it allowed you to do all kinds of magical things.
That's not how the WebView2 control works. While you could technically still use mshtml for generating html, it doesn't make as much sense and there isn't a way to connect it to the control. You could load the result as a string though.
Besides that [URL="https://en.wikipedia.org/wiki/Trident_(software)"]mshtml[/URL] is AFAIK a part of the old browser control, so it is marked obsolete as well.
With WebView2 you are able to get the data that is send over the line.
But it creates a new task for each file that your page is made up of and returns each task as an IStream object.
From what I've seen so far, these IStream objects don't have an indication if they are returning a string or a bunch of bytes (for example a picture), the name structure is not filled in my tests either.
I'm now offering this resource result event as a string, but that might not make a lot of sense in most cases.
Besides that... even if you would know what goes over the line, things get cached and a reload of your page doesn't get as much data as the first request might have done. Messing with the content mid stream.. also not that recommended.
So that is also a dead end for this type of thing.
Is there nothing that can give us a "scrape" of what is in the browser?
Yes, actually there is.
As you know, we live in a javascript world nowadays :)
There's an "executeScript" method which allows you to run javascript in the document that is currently displayed in the browser.
This also triggers an event with the result of that javascript call.
You can use that to retrieve the document content, fill particular parts in the html and even do things like trigger button clicks.
From what I see now and my preliminary tests with that, it should work OK.
I will see if I can add this as a demo to the DataFlex application.
However for the moment I'm focusing on the base ActiveX wrapper, not on manipulating what is rendered in the browser.
It is possible to add that type of thing later on, but it is not actually a native msedge WebView2 feature.
At least I haven't seen it.
Hope this helps,
--
Wil
Re: MS Edge WebView2 ActiveX wrapper
Hi Wil
That's looking pretty good Wil, nice work! Talking mshtml and the DOM, have you attempted to use your tinyMCE interface in Web View 2 yet?
Re: MS Edge WebView2 ActiveX wrapper
Marco,
Last night I played a bit with this.
As some of it can be challenging, like the json object encoding of the results and additional error checking, I do see value in adding this right away.
So I will add an additional automation interface for easy manipulation (this will push my time lines a bit, but oh well...)
Thanks for the suggestion.
--
Wil
Re: MS Edge WebView2 ActiveX wrapper
Hi Tom,
Nope, just trying to focus on the main parts first before I even entertain ideas like that.
It should be possible though.
--
Wil
Re: MS Edge WebView2 ActiveX wrapper
Hi Wil
I thought that may be the case.. but it's nice to know there looks like there's a pathway forwards.