LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

C# as GUI with LabVIEW

Hi. I am trying to create 3rd party GUI with LabVIEW program. I am considering Windows Form Application as GUI. How to communicate these two programs? I want to send a string for path of image and LV should return image to the GUI which is C# app. In order to do it, I created a test LV script I added input string and image display as an output but I could not get the result. Has anyone done it before?

 

Do you have other idea for 3rd party GUI with LabVIEW as backend program? Thank you in advance.

0 Kudos
Message 1 of 3
(545 Views)

I'm sure it's possible but why in the world do you want to do that? Are you really that masochistic inclined?

 

GUI embedding is wrought with lots of problems. While it usually works for very simple applications it sooner or later is bound to break down as you go more and more complex because of threading issues, process isolation and similar stuff and that all is bound to only get more complex as new security measures are added to modern OSes to prevent new attack vectors.

 

What you can do is to create DLLs with the desired functionality in LabVIEW and call them as function library from your other program if you really are interested in this. Another approach is to have both applications communicate through an IPC (InterProcess Communication) channel with each other. Nowadays the ubiquitous TCP/IP protocol is usually the first choice to do that as it is supported in pretty much any programming environment you can think of.

 

Anything else is more trouble than it is worth.

 

As to transferring images around on the system you need to be aware that "image != image". Every image library has its own format of image object. A LabVIEW IMAQ image is absolutely NOT a .Net Image object. 

 

If you want to pass such an image to a .Net application you have to create it as a .Net Image object. This is done by reading all the relevant attributes of the IMAQ image, creating an according .Net Image, then copy the IMAQ image pixmap data to the .Net Image observing any difference between the two such as PixelFormat, scan row padding and similar things. There is not a ready made function that can do that automagically since there are so many different possible image pixel formats.

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 3
(540 Views)

@oguzk wrote:

Hi. I am trying to create 3rd party GUI with LabVIEW program. I am considering Windows Form Application as GUI. How to communicate these two programs?


Again, WHY?

 

It would greatly depend on why you'd want this. There could be very good reasons, but the recommended solution would depend on the reason.

 

A C# GUI would use .NET, so why not simply use .NET in LabVIEW to create the GUI? Then again, why not just use LabVIEW?

 

You can make a dll in LabVIEW and call it in C#.

 

You can make a dll in C# and call it in LabVIEW.

 

You can make 2 executables and interface over TCP\IP (REST, WS, whatever).

 

You can make a GUI in LV NXG web VI and run the GUI in a browser...

 

Again it depends on why you want this.

 


@oguzk wrote:

I want to send a string for path of image and LV should return image to the GUI which is C# app. In order to do it, I created a test LV script I added input string and image display as an output but I could not get the result. 


Post what you have.

And also why you want this 😁.

 


@oguzk wrote:

Has anyone done it before?


Converting a LabVIEW Pixmap to a .NET image, sure.

 

It's probably easier to send the path to .NET and make .NET open the image as a .NET image.

0 Kudos
Message 3 of 3
(526 Views)