From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I embedded the Chromium Embedded browser in LabVIEW?

Solved!
Go to solution

I'm attempting to use the Chromium Embedded web browser as an embedded HTML and PDF viewer in a LabVIEW 2013 application.  I have been attempting to use the Chromium Embedded Framework via its .NET bindings, but I have not been successful in getting an embedded web browser into LabVIEW 2013 with the CefSharp.Wpf or CefSharp.WinForms.  I'm new to .NET work in LabVIEW, so it could very well be a mistake on my part.  It appears that someone has gotten the Webkit .NET framework going inside LabVIEW, but I'm not able to do that either.

 

Any help would be appriciated.

 

Thanks,

Chris Davis 

0 Kudos
Message 1 of 10
(8,700 Views)

Hi Chris,

 

I tried to do the same and ended up giving up completely on getting Chromium to work.

 

I have, however, been able to get the WebKit browser as a .NET control working fairly easily:

2015-02-11_17-03-22.png

 

I tried to attach the resource pack for the WebKit browser as I can't remember where I obtained them from in the first place but I think I probably just searched for ".NET WebKit". If you have trouble finding it then I can send you the .zip with all the files in (PM me contact details). Just create a .NET control and select the WebKitBrowser.dll from the resource pack extracted to your project folder somewhere.

 

I haven't really played with it any more than the above example of loading a web-page though.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 10
(8,685 Views)

I've downloaded the WebKit 0.5 package from sourceforge, but I'm not familiar enough with .NET in LabVIEW to know what to do next.  I've tried creating a .NET container on my front panel, but when I try to "Insert a .NET Object" in that container, and I browse to the WebKitBrowser.dll, it tells me there is an error with this assembly (screenshot below).  Perhaps a quick rundown of how you have the basic WebKit .NET assembly working in LabVIEW would be in order.

 

Thanks!

 

 

0 Kudos
Message 3 of 10
(8,679 Views)

I did exactly that and it works for me. Create .NET container, right click and insert .NET control, browser to WebKitBrowser.dll and then it shows the WebKitBrowser control in the list underneath:

2015-02-11_17-40-42.png

 

Have you checked you have all of the requirements installed? (.NET Framework 2.0 and the Visual C++ 2008 SP1 runtime)


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 10
(8,675 Views)

Sorry, no luck here.  I have the Visual Studio 2008 SP1 runtime and .Net 4.5.1 installed.  Any other hints about how you were able to get the WebKit browser to work?

0 Kudos
Message 5 of 10
(8,624 Views)
Solution
Accepted by topic author JacobsCSD
0 Kudos
Message 6 of 10
(8,619 Views)

Strange, I don't remember having to do anything with unblocking .NET assemblies. Like I said - I just dropped the .NET control on the front panel and selected the WebKitBrowser DLL and it worked.

 

1) .NET 4.5.1 does not include .NET 2.0/3.0/3.5 etc. - you specifically need to have .NET 2.0/3.0/3.5 (3.0 and 3.5 are extensions to 2.0). .NET 4 is separate to 3.5/3.0/2.0. Do you have .NET 3.5 installed?

 

2) You have to be very specific about the "Microsoft Visual C++ 2008 Redistributable - x86" - there's no mention of Visual Studio in there

 

I have a virtual machine for doing LabVIEW at home and again, it worked out of the box without needing to do anything with unblocking assemblies. Here's a list of the versions of .NET I have installed (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP)  and the Visual C++ redistributable:

11-02-2015 21-12-20.png


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 7 of 10
(8,613 Views)

Sorry Sam, I meant that I had installed the Visual C++ 2008 Runtime.  See my image for confirmation.  I've also found where I can activate the .NET 3.5.1 run time in Windows 7 (see image for confirmation).

 

Still no luck.  

0 Kudos
Message 8 of 10
(8,597 Views)

It seems like the LabVIEW.exe.config file has made LabVIEW happy enough to load the Webkit Browser .NET assembly.  I can now view the Google homepage in my LabVIEW application.

 

I'm still interested in getting Chromium to work since it seems to have a PDF viewer built into it.  Unless someone else knows of a way to view a PDF in LabVIEW...

 

Thanks Sam and J-M!

0 Kudos
Message 9 of 10
(8,584 Views)

Found this old thread because I wanted to embed a Chromium web browser on the front panel.

 

I tried to get the CefSharp browser working with LabVIEW but I ran into a few major issues:

  • You have to build either the 32-bit or 64-bit CefSharp control. AnyCPU build won't work with LabVIEW 32-bit and 64-bit
  • CefSharp expects the runtime assemblies and their dependencies to be in the same folder as LabVIEW.exe
  • You have to set CefSettings.BrowserSubprocessPath to locate CefSharp.BrowserSubprocess.exe
  • I had to manually copy CefSharp.Core.dll next to CefSharp.DLL in my \AppData\Local\assembly\dl3 folder
  • After all that, I was able to get LabVIEW to load the CefSharp control, but then I got a "Cannot pass a GCHandle across AppDomains" runtime exception. At this point, I gave up and started to look for another option.
  • That's when I found the WebView control for MS Edge.

I had success hosting the Microsoft Edge WebView2 control that is also Chromium based.

Implementation is pretty straightforward. AnyCPU build works with both 32-bit and 64-bit LabVIEW.

The only downside is the control requires either Microsoft Edge or the WebView2 Runtime to be installed.

 

 

I posted my source code and examples here

Regards,
miko
Message 10 of 10
(2,688 Views)