LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

External EXE file needs to display data in Labview

I have an EXE file from a vendor for which I dont have the source code. The EXE file calls internal functions that need a Window handle to display 3 pieces of data which can be numbers or strings (status, error codes etc). The vendor also provided a test program with source code that creates a Window, provides a window handle and it uses WPARAM and LPARAM. The test program works fine with the EXE file and the data is updated. For example the progress percentage updates from 0 to 100%. 

 

I want that same data to display in Labview. I will have 6 instances of the EXE file, with each instance needing its own Window handle to display its own set of data.

In short Labview has to provide a Windows handle and 3 data fields which the EXE file can update.

 

The vendor does not have a test program written in Labview. I have searched the forum for this topic and tried out different VI's found in lvwutil32.zip. I have used FindWindow in user32.dll to find a window handle. I have tried creating an ActiveX window to see if I can get its window handle but I havent been able to find a solution.

 

It would be great if I can find a working example of a VI where an external EXE file is able to write data into a Labview window/container and update specific text fields in Labview.

 

I have a backup plan: Make the test program write out the data in text files and get Labview to read and process the text files but that is more complicated and might slow down the process. I wish I could get the EXE files to directly send the data to Labview.

0 Kudos
Message 1 of 5
(4,321 Views)

In short: No. For two executables to interact with each other, they normally need to have some sort of interface (e.g. ActiveX, TCP/IP, UDP, Windows Pipes etc.) to allow them to communicate between each other.

 

If the executable you are using has an ActiveX interface - then you can use this to communicate with it from LabVIEW. You'll need to study the source code of the test application they provide (if it does that) to see how it is connecting (or get support from the vendor) - if it's using window handles...if it's calling Windows functions (e.g. user32.dll) - then you should be able to replicate those calls in LabVIEW.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 5
(4,304 Views)

@Sam_Sharp wrote:

In short: No. For two executables to interact with each other, they normally need to have some sort of interface (e.g. ActiveX, TCP/IP, UDP, Windows Pipes etc.) to allow them to communicate between each other.

 

If the executable you are using has an ActiveX interface - then you can use this to communicate with it from LabVIEW. You'll need to study the source code of the test application they provide (if it does that) to see how it is connecting (or get support from the vendor) - if it's using window handles...if it's calling Windows functions (e.g. user32.dll) - then you should be able to replicate those calls in LabVIEW.



Thanks for your reply. As I mentioned in my first post, the test application uses Windows functions and handles. It does not use user32.dll so I cannot replicate any DLL calls in Labview. I have the source code of the test application and can give you any needed information from it. It uses windows.h and deals with things like: WM_COMMAND, WPARAM, LPARAM etc. Here's the header of the calling function:

LRESULT CALLBACK MainMenuProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)

WPARAM contains the name of the text field that needs to be updated (there can be 3 text fields).

 

So how can I get Labview to create a Window, provide a Window Handle and also provide 3 text fields, all of which can be recognized by the external EXE command?

The EXE file is basically a Windows application. The vendor has not worked with Labview and doesnt know anything about it.

0 Kudos
Message 3 of 5
(4,292 Views)

LabVIEW has it's own window manager and/or functionality for the controls on the block diagram so while you can probably get the windows handle for your front panel, I doubt there is a way to 'set' or 'name' controls on the front panel so that the external executable can update them.

 

I think I would try to write a windows executable (e.g. in C) based on their sample application, and have that send the data to your LabVIEW (e.g. using TCP/IP / UDP etc.) application. This might be more immediate/faster than writing/reading to files.


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 4 of 5
(4,281 Views)

Thank you. I will try TCP IP. I'm new to it (doing it in C and Labview) so it will be a learning experience.

0 Kudos
Message 5 of 5
(4,262 Views)