LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use WebView2 control in LabView?

Solved!
Go to solution

Thanks Greg, when you copied the .dlls into the LabVIEW folder, which .dlls did you copy or did you just paste the entire unzipped nuget package into the LabVIEW folder?

 

I have tried many different combinations but keep getting an error when pointing the .net control to the .dll.

 

 

 

 

0 Kudos
Message 21 of 31
(2,848 Views)

I know there have been a lot of examples here, and I apologize for being dense, but I cannot get any web pages to load. It seems like the source never loads, not sure if it is a company firewall thing or not, any ideas?

 

Thanks

mcduff

0 Kudos
Message 22 of 31
(2,742 Views)

Never mind, I am really dense. I got the nuget packages but forgot the runtime engine.

 

Thanks

Andrew

0 Kudos
Message 23 of 31
(2,736 Views)

how did you solve the problem? i have the same problem and i cant fix it

Thank you

0 Kudos
Message 24 of 31
(2,568 Views)

Hello

I followed all the steps, but it doesn't want to work. Property node "CoreWebView2" always returns null.

If I use the "WebView2.EnsureCoreWebView2Async" invoke node and then the "Wait()" node, I always get the same error "1172" "Error 1172 occurred in the error call method of the System.Threading.Tasks invoke node. Task.Wait , (System.DllNotFoundException: Unable to load DLL 'WebView2Loader.dll': The specified module cannot be found. (Exception from HRESULT: 0x8007007E))

Possible reasons):

LabVIEW: (Hex 0x494) A .NET exception occurred in an external assembly. For information about how to correct this error, copy the following exception (in bold) and search the Microsoft Developer Network (MSDN) Web site or the Internet for a possible explanation.
System.DllNotFoundException in webview2_2 (2).vi"

Thanks

0 Kudos
Message 25 of 31
(2,541 Views)

Hi all,

 

thanks for your hints. I first had troubles gettings everything together, but now I think I've got it.

 

First, the VI provided by beavercreek did not work for me. I either got an empty page, forever waiting, or the DLLNotFound Exception.

 

So I modified the instantiation process so that the path of the native "Loader" dll is provided as well as the waiter for it to finish. Feel free to look into the modifed file attached.

 

Steps to get it to work:

  1. Download the WebView2 Nuget and unzip it
  2. locate the file "lib\net45\Microsoft.Web.WebView2.WinForms.dll" and either use it to insert the .net control
  3. From the unzipped file, locate the "build\native" folder and paste it in the control of the vi

 

Message 26 of 31
(2,111 Views)

I bundled my findings into a XControl you might test if you like

Message 27 of 31
(2,088 Views)

Some further improvements. Check out the github repo:

 

https://github.com/kleinsimon/LV-WebView2

 

Message 28 of 31
(2,058 Views)

I have been playing around with WebView2 and Labview for a while but with very mixed results.

Spaghetticoder´s X-control worked immediately for me, and even better kept working.. I even can call js-code with the included property😁. Great work!
Currently I try to get the return value from my js-function, is there a way doing this?
 

0 Kudos
Message 29 of 31
(1,993 Views)

I was able to figure that one out for myself, see my code attached. It can directly be used in Spaghetticoders X-control  in the run JavaScript Method.

Thanks again for providing the X-control, I learned a lot😎

0 Kudos
Message 30 of 31
(1,942 Views)