NI Home > Community > NI Discussion Forums

LabWindows/CVI

Reply
Member
fishingman
Posts: 75
0 Kudos

Application Architecture

Hello,

I am trying to design a small application using the tool Labwindows. I wanted to get some information to properly design the application. I have a basic GUI that uses theDLL. I want to adopt this architecture to make it easier to update future. One thing I do not know if I can add windows or GUI if I need without having to compile the program again.
Will you help me with a method that allows me to ensure easy update of the application (code level and interface) without having to uninstall the thing after previous.



Thank you for your help.

Member
Trey_C
Posts: 74
0 Kudos

Re: Application Architecture

Hi Fishingman,

 

If I understand what you are trying to do then I think the best way to make your code modularized and easy to update would be to create the portions of your code that you anticipate might change within DLLs.  As long as the function prototypes in the dll do not change then you will be able to recompile a new dll and push this into your application folder without needing to recompile the executable.

 

Illustration:

I create a dll with a single function called 'Add(int x, int y)' but I accidentally set the return to 'return x;'.  I compile my exe that includes this DLL and calls Add(5, 5).  After a week, I notice that this behavior is returning 5 whichs is incorrect so I open the project my DLL was created in, change the return statement to 'return x+y;' and then replace the old dll with this new dll. I can then run my code and it returns 10 instead of 5 even though I haven't changed my executable.

 

As far as working with the GUI in specific - I can understand wanting to save what may be a potentially long compile time when changing the GUI; however, I would not suggest using a DLL to create and run your GUI.  If this would work, the modifications to the GUI functions in order to make this work would probably take more time and work than recompiling a few extra times.

 

Regards,

Trey C.

Member
Trey_C
Posts: 74
0 Kudos

Re: Application Architecture

A small expansion on my original post:

 

If you are just looking to be able to modify the user interface in a dll then take a look at this link.  It explains how to set up dll function calls to modify a user interface.  Depending on the extent to which you want to modify your user interface, this can definitely be a valid approach.

 

Regards,

Trey C.

Member
fishingman
Posts: 75
0 Kudos

Re: Application Architecture


Hi,

Thanks for your response. Really,my project is to develop a small sequencer used to develop test programs and to the sequencing of these programs. I want to divide the project into several parts (Hardware Management, Management of the GUI, and management of test sequence). Each party will be written in a DLL, making it easy for the update or correct the problems. I do not know if my method is best.

Using this method, I need to modify the graphical user interface (assign values ​​to the textbox, tables ...) in different DLLs.

Do you recommend me this method? 

Thanks

Member
Trey_C
Posts: 74
0 Kudos

Re: Application Architecture

Fishingman,

 

I think I understand a bit better what you are trying to accomplish with using DLLs for your GUI and based on your description I would agree with you that DLLs are well suited for this project.  Additionally, you seem to have already segmented the sections into logical parts so it looks like you are off to a great start!  I would definitely recommend modularizing your code in this fashion because, as you said, it does make updating the project much easier.  

 

Good luck with your project, I hope it goes well!

 

Regards,

Trey C.

Active Participant
D_Biel
Posts: 676
0 Kudos

Re: Application Architecture

fishingman,

 

You can update the UIR file of a project without recompiling as long as the UIR is not embedded in the exe or DLL. However, you will need to pay attention to how your code interacts with the controls. For example, if you remove a switch that you get the value of in your code, then this can cause run-time errors. Cosmetic changes should be fine though.

 

It sounds like you want to add windows to the UIR. This may be tricky to do because you will not have code that corresponds to the new windows.

National Instruments
Product Support Engineer
Member
fishingman
Posts: 75
0 Kudos

Re: Application Architecture

[ Edited ]

Hi,

I use this method to control my GUI with the external DLL:

http://digital.ni.com/public.nsf/allkb/2324075BD2356ECE86256BC1005AD4A8?OpenDocument

But i found that this method is a bit difficult(heavy).

I have to pass all  controls that I changes in parameter?

Do you have another way (control array,...)?

thanks

Member
Trey_C
Posts: 74
0 Kudos

Re: Application Architecture

Fishingman,

 

In order to be able to modify the panel controls from inside a DLL you will need to pass both the panel and control IDs into your functions because these are both necessary to know which panel is being modified as well as what control to act on.  Depending on the extent you are looking to modify your panel, this definitely does get a bit heavy in which case I might refer to D Biel's post above - specifically that you can modify the UI file without recompiling - in most cases a lot of the modifications can be done in this UIR file.

 

 

Regards,

Trey C.