LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

C# Gui for Labwindows Program

Hi,

 

I have an existing program with a user interface developed in labwindows.

I would like to change it and make it more user-friendly, "beautiful" and in step with the times.

Unfortunately using labwindows I cannot do it because the UI development tools are not adequate.

 

I want to develop my UI in Visual Studio with C#.

Which is the simplest way to connect the Ansi C labwindows program with the Gui in C#?

(My idea was to "Insert" the gui in a dll and call it from labwindows, but I don't know if it's possible)

 

Thanks in advance.

0 Kudos
Message 1 of 13
(2,668 Views)

@johnbop wrote:

 

I want to develop my UI in Visual Studio with C#.

Which is the simplest way to connect the Ansi C labwindows program with the Gui in C#?

(My idea was to "Insert" the gui in a dll and call it from labwindows, but I don't know if it's possible)


That sounds like putting the cart in front of the horse!

 

If I would want to do it, which I won't very soon as I'm not someone who feels like chasing the latest craze in UI development and getting excited about changing rounded corners to sharp corners (Win7 to Win 10), and then changing them back to round corners is like the nirwana of UI development, I would separate the business logic of the CVI program into its own library and then access that library from a Visual C application.

 

There you can go all wild with your UI design as much as you want, only to change it back in a few years again when Visual Studio 2023 will be released, which might use all UWP, or maybe they declare GDI again the defacto standard. 😁 It sure will keep you busy! 😀

 

Trying to shoehorn an UI library into a development environment is always a problem. Using predeveloped (and of course fully tested) function libraries in a specific environment is a lot easier. You have to implement some bindings of course, such as a PInvoke interface if you want to access the unmanaged CVI libraries from a managed .Net application developed in C#, but that while it can be tedious work to do, is magnitudes easier than trying to wrap a predefined external UI around your functions in CVI.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 13
(2,624 Views)

Thanks Rolfk for the answer,

 

So do you recommend to use PInvoke?

(Consider that the project is big and it uses many functions of the CVI)

Thanks

0 Kudos
Message 3 of 13
(2,615 Views)

@johnbop wrote:

Thanks Rolfk for the answer,

 

So do you recommend to use PInvoke?

(Consider that the project is big and it uses many functions of the CVI)

Thanks


Whatever works for you. If you program in C# your program is managed. LabWindows CVI code is not managed (in the meaning of .Net). That means you have to somehow create managed-unmanaged bindings to use LabWindows CVI libraries in your C# code.

 

If you use PInvoke, create your own C++ CLI interface or do Interop Marshalling directly in the C# code, is up to you. Each has its own pros and cons but none is trivial.

 

It may be the perfect time to review your program code and identify clear and concise libraries and interfaces in order to minimize the effort you have to do in creating those bindings.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 13
(2,604 Views)

Thanks Rolfk,

 

if anyone else has ideas please write them below.

 

Thanks in advance

0 Kudos
Message 5 of 13
(2,591 Views)

Just out of curiosity, I would like to have some samples of what you intend for user-friendly, "beautiful" and in step with the times user interface.

 

As I told you in your other thread I'm not willing to experiment with such language mixture, nevertheless I'm curious and always prone to understand if there's some new and useful concepts out there so please share your ideas with us.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 6 of 13
(2,587 Views)

Dear Roberto,

 

Thanks for your precious help,

 

I attached some example:

https://github.com/mklanac/EPEdashboard

 

(the avast example is only at the "start menu" level).

 

Thanks.

Download All
0 Kudos
Message 7 of 13
(2,581 Views)

When I see such UIs I always think, nice, someone spend lots of hours to make a shiny UI, I hope he spend 10 times as much energy to make the actual functionality underneath work! But quite often that is idle hope!

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 8 of 13
(2,576 Views)

Rolfk,

 

This program has been working great for 10 years, so now I want to focus on Ui.

Thanks in advance

0 Kudos
Message 9 of 13
(2,572 Views)

From what I understand there are some possibilities, like:

 

-Pinvoke

-C# Dll with "internal" Gui

-Network Variables, but I don't know how to use it

- .Net Controller

-Active X Server

 

In general, however, I didn't understand how to do it and which method to choose.

 

Thanks in advance for advice

 

0 Kudos
Message 10 of 13
(2,548 Views)