OpenEdge 11.7.5 - Embed Chrome Browser

Posted by atuldalvi123 on 18-Mar-2020 09:46

Hello,

How to embed the chrome browser in the application ?

Thanks in advance.

All Replies

Posted by oedev on 18-Mar-2020 10:06

Not sure if something is available directly with Google Chrome, but there is this Open Source component based on the Chromium engine that could be embeded.

http://cefsharp.github.io/

Posted by Marko Myllymäki on 18-Mar-2020 10:57

I tried that CefSharp a few months ago. It worked, but it also made the application quite unstable. The application crashed occasionally and I didn't find a reliable workaround for that. Maybe the latest version works better, might be worth a try.

I decided to wait for the upcoming (Chromium-based) WebView2 control from Microsoft:

docs.microsoft.com/.../webview2

There is not an official WinForms version of WebView2 available yet, but it should be coming in the next few months.

Posted by atuldalvi123 on 18-Mar-2020 11:37

Hello,

Can you guyz guide me on how should I start with CefSharp  ?

Or someone can give me a sample code for this will be good.

Posted by dbeavon on 18-Mar-2020 13:15

>> There is not an official WinForms version of WebView2 available yet, but it should be coming in the next few months

The new webview2 is not likely to be more stable than CefSharp.  It is brand new and will have a long way to go to work out the kinks.  Whereas CefSharp is being maintained regularly and is quite mature:

www.nuget.org/.../CefSharp.Common

I am also looking forward to WebView2, but for other reasons.

Unless you investigate the underlying reasons for the instability, it would be optimistic to count on WebView2 being the solution.  Internally they will use a lot of the same implementation.  I suspect the instability is related to the interop with the rest of your application.

Posted by Brian K. Maher on 18-Mar-2020 13:18

Search the KBase for ‘cefsharp’.  There have been memory leak issues with it.
 

Posted by atuldalvi123 on 18-Mar-2020 13:52

ohk

Posted by atuldalvi123 on 19-Mar-2020 12:03

Hello

Can anyone give me guidance on how I can try cefsharp with OpenEdge.

I checked the help online there, but its tor C # and .Net.

Please guide me if anyone has experienced cefsharp with OpenEdge.

Posted by atuldalvi123 on 19-Mar-2020 12:51

Hello,

Can someone guide me on how to go with cefsharp for OpenEdge ?

Posted by atuldalvi123 on 19-Mar-2020 13:31

Or Can we open Chrome browser directly from OpenEdge like Internet explorer ?

Posted by rdhaan2 on 19-Mar-2020 14:19

I've tried to get CefSharp to work,but de .NET in the assemblies was no problem.

However, there we more .DLL which are started, and they need to be in your path somewhere. So in the 'Controls' folder or in the 'Openedge' dir did not work for me.

I tried some more and finally found DotNetbrowser which i';ve got working in a .NET form. However, this costs money.

Keep in mind - every control i've found is getting into this problem - Chromium is multi threaded. So call from Progress to or better calls back from Javascript are difficult... Every time I got Progress errormessages that call it from a multi threaded process is not possible.

Also, much controls use reflection and/or generics. This is not something Progress is good in (not supported that is).

Posted by jquerijero on 19-Mar-2020 15:00

[quote user="rdhaan2"]

I've tried to get CefSharp to work,but de .NET in the assemblies was no problem.

However, there we more .DLL which are started, and they need to be in your path somewhere. So in the 'Controls' folder or in the 'Openedge' dir did not work for me.

I tried some more and finally found DotNetbrowser which i';ve got working in a .NET form. However, this costs money.

Keep in mind - every control i've found is getting into this problem - Chromium is multi threaded. So call from Progress to or better calls back from Javascript are difficult... Every time I got Progress errormessages that call it from a multi threaded process is not possible.

Also, much controls use reflection and/or generics. This is not something Progress is good in (not supported that is).

[/quote]

You will need to write a custom DLL that will act as intermediary between Progress ABL and CEFSharp. This DLL will listen to CEFSharp, then it should use Invoke to fire an event that the ABL code is subscribed to.

Posted by dbeavon on 19-Mar-2020 17:15

CefSharp is hard enough to use from a c# developer's perspective because it interop's with native libraries.  It will be that much harder from OpenEdge/ABL since that will involve another layer of additional interop.  If you want this bad enough I would suggest developing your the main application window in c#/.Net (winforms or wpf).  

I happen to be playing with the packaging/deployment of CefSharp redistributables today.  That is a big pain too.  (It is what you get to look forward to after you finally have everything working on your own development machine.)

Posted by Patrik Wikström on 20-Mar-2020 07:46

We are also now at the deployment stage and having some challenges to get all the files install correctly so CefSharp is able to find the files. The CefSharp error message about not finding all resources is not very helpful. In development we got it working much easier.

Posted by atuldalvi123 on 20-Mar-2020 07:50

Can you let me know how should i start CefSharp  with OpenEdge in development  ?

Posted by Patrik Wikström on 20-Mar-2020 08:00

Hope this helps? Might be some errors in there still so read carefully and don't trust it blindly....

If someone knows a easier way to get the packages downloaded, please tell!

How to get the CefSharp plugin installed for the first time

Developer Studio / Application needs these

  • We need all the WinForms, Common and cef-redist files.
  • We need to add three CefSharp dll-files to our assemblies.xml and configure one additional subfolder for the location of the Cefsharp files in assemblies.config.

Steps

  • Install NuGet command line tool https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-nuget-cli
  • Download packages (https://www.nuget.org/packages/CefSharp.WinForms/). Notice! Be very careful which versions of other packages the package depends on. 75.1.143 of Commons and WinForms and 75.1.14 of redist.
    • nuget install cef.redist.x64 -OutputDirectory C:\tmp\cefsharp -Version 75.1.14 (nuget install cef.redist.x64 -OutputDirectory C:\tmp\cefsharp)
    • nuget install CefSharp.Common -OutputDirectory C:\tmp\cefsharp
    • nuget install CefSharp.WinForms -OutputDirectory C:\tmp\cefsharp
  • Gather the 64-bit files from the output directories into a single directory:
    • C:\tmp\cefsharp\cef.redist.x64.77.1.14\CEF
    • C:\tmp\cefsharp\CefSharp.Common.75.1.143\CefSharp\x64
    • C:\tmp\cefsharp\CefSharp.WinForms.75.1.143\CefSharp\x64
  • Remove the unnecessary *.pdb files.
  • Install all the files in the folder C:\src\assemblies\CefSharp.
  • Add (if not already added) the "CefSharp" to the C:\src\assemblies\assemblies.config.
  • Add the three dll-files to one of the Developer Studio project "Referenced Assemblies".
    • CefSharp.WinForms.dll
    • CefSharp.dll
    • CefSharp.Core.dll
  • Now the Developer Studio installation is ready. 

Posted by atuldalvi123 on 20-Mar-2020 10:40

Will try all these steps.

Thanks

Posted by atuldalvi123 on 20-Mar-2020 12:14

Hello,

I have installed everything but now I am not clear on the below steps -

Add (if not already added) the "CefSharp" to the C:\src\assemblies\assemblies.config.

Add the three dll-files to one of the Developer Studio project "Referenced Assemblies"

Can you explain it in more details.

As adding these DLL throw below error -

Error

---------------------------

BadImageFormatException for assembly: E:\cefsharp\CefSharp.Core.dll
Could not load file or assembly 'file:///E:\cefsharp\CefSharp.Core.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

This thread is closed