LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use a VI (with interface) in another program by DLL

Solved!
Go to solution

Maybe I could rephrase. How to keep the control of the state machine in C++ ? You said that there is a way to keep the front panel by calling the dll ?

0 Kudos
Message 11 of 28
(1,478 Views)
Solution
Accepted by gautierdufourcq

@gautierdufourcq wrote:

Maybe I could rephrase. How to keep the control of the state machine in C++ ? You said that there is a way to keep the front panel by calling the dll ?


I did some searching around, it seems like this should do it:

 

To show the Front Panel of the VI when it is called inside the DLL, open the VI and go to VI Properties»Window Appearance»Customize.  From this window, you can choose to Show Front Panel When Called.  Enable this option.

 

Source: http://digital.ni.com/public.nsf/allkb/D363FE185910D952862569F40078FF8C 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 12 of 28
(1,471 Views)
Solution
Accepted by gautierdufourcq
I already said that it is a build option to not remove the front panel.
0 Kudos
Message 13 of 28
(1,464 Views)

Thank you very much. It is the first thing I will test tomorrow. I hope that DM will charge the dll.

0 Kudos
Message 14 of 28
(1,462 Views)
What is DM? You said you wanted to call the dll from c++.
0 Kudos
Message 15 of 28
(1,456 Views)

DM is the Digital Micrograph software (no, I don't know anything about it either) mentioned in the initial post (and also in a later post).

 

What are you actually trying to do? When you call a LabVIEW VI in the DLL, that VI executes until it ends. The calling thread (the thread in your C++ code) is busy until the VI stops. There is no straightforward way for the C++ code to pass new values to the LabVIEW VI (for example, to stop the VI) - is this something you need to do? Is the C++ code multithreaded - can it continue to do something else while the LabVIEW VI is running?

 

If your C++ code is multithreaded, you can add additional VIs to the DLL that handle communication (through named queues or notifiers, user events, or functional global variables). You would then call those VIs in a separate thread after launching the main VI.

0 Kudos
Message 16 of 28
(1,446 Views)
So dm is some exe that can only call c++ code (properties and methods) and instead of writing c++ code to directly access the c++ api for DAQmx, you wrote one large LabVIEW VI?
0 Kudos
Message 17 of 28
(1,439 Views)

Exactly. The main software is DM. It excutes dlls. These dlls are written in C++ and can use VI (effect of wrapping). Indeed, my problem is the monitoring. When the VI is running, I can not communicate until the VI ends. I tried multithreding, I could not receive data passed by pointer while the VI was running because data were in the while of the running VI. keeping the front panel, i hope to create a thread that allows me to launch and change values in the dll. Then, I will try to create another in which I will read data.

0 Kudos
Message 18 of 28
(1,430 Views)
And why don't you want to create a single LabVIEW VI with multiple functions in it? Why do you insist that the loop be there? Does this dm interface to other code not have any flow control ability?
0 Kudos
Message 19 of 28
(1,423 Views)

DM can do multithreading. But the problem is, i do not understand the VI because I did not conceive it. So I am trying to convert it in a good dll. That is why I would need the interface. I am, for the moment, unable to create sub VI because evrything is dependant. So, I hope to get the frontpanel.

0 Kudos
Message 20 of 28
(1,418 Views)