LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing to control in a EXE from another VI

Hi,

 

I tried the steps exactly as in the below links to write to a control in a EXE but facing an Error 1004, "To load a VI into memory with the Open VI Reference function, a path must be wired for the VI Path input.".

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019LbZSAU&l=en-IN

 

I have also enabled TCP/IP protocol in VI server option.

 

I have programmatically(as well as manually tried) launched the EXE successfully before executing the section where it tries to write to the control of the exe.

 

Any suggestion will be highly approciated.

 

0 Kudos
Message 1 of 5
(162 Views)

You cannot directly interact with a control in another executable. Each application is in it's own memory space. You will need to implement some type of messaging system between the two applications. I generally use TCP for this. You can also use network shared variables or network streams. Personally, I would avoid network shared variables.

 

EDIT: Based on the article you posted there may be a way to call a VI within another executable using the VI server but this is not the same as interacting with a control itself. For inter-process communications I still prefer to implement an actual messaging API. It is much more flexible and more powerful.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 5
(137 Views)
Highlighted

Hi Mark,

Thanks for your reply.

I looked again in the Link and it is talking about calling a exe in a VI. I think there is a way and I am missing out something. 

Long time back I remember one of my colleague doing something similar to this. 

 

0 Kudos
Message 3 of 5
(84 Views)

Hi,

 

I solved the issue.

 

The port number used in the EXE and the VI should be different to the one mentioned in the VI server section of the LabVIEW.

 

0 Kudos
Message 4 of 5
(70 Views)

The problem is that Open VI reference with a string input only works when the VI in question is already in memory. So your application needs to somehow load the VI first, that could be by adding it to a case in a case structure that is not normally executed (but don't use a Boolean constant on the diagram, LabVIEW does so called dead code elimination and since it can determine at compile time that this case will never be executed it does remove it from the compiled code).

 

The port number you try to connect to from your client should NOT be different, but match the port number for the VI Server port you have set in the INI file of your executable.

Rolf Kalbermatter
Averna BV
LabVIEW ArchitectLabVIEW ChampionLabVIEW Instructor
0 Kudos
Message 5 of 5
(61 Views)