03-14-2019 02:14 AM
Hello,
I need to send data (array of integers) from my LabView application to another non LabView Windows application by using WM_COPYDATA message. There are several posts in the forum discussing the same issue but none of them has the full solution.
As I see the main problem is not to call the SendMessage/PostMessage but to make a wrapper around this call and to ensure the data is valid when the message received in the other application. There is a example for such DLL wrapper (a DLL which will deal with sending of the message and holding the data array) but after compiling the example DLL I was not able to see it working properly.
In my projects I used several times WM_COPYDATA for data exchange between non LabView Windows applications and I never had problems.
My question is - does somebody have a working and tested example for using WM_COPYDATA to send data from LabView to another Windows applications? I'll really appreciate any help. Thank you!
Solved! Go to Solution.
03-14-2019 02:20 AM
Have you tried the example shown here:
03-14-2019 08:54 AM - edited 03-14-2019 08:55 AM
Hi,
Yes, I have seen this library before, but unfortunately they have only 32 bit version where the target is LV 64 bit. If you have by change the library for 64 LabView I'll be very thankful.
03-15-2019 03:57 AM
Hey Peter,
Not sure if you are limited to WM_COPYDATA or need it out of a specific reason. I am sure it will work somehow, but never used it, so I cannot give any useful hints.
What I have done whatsoever, is using a different approach to exchange data between programs: Memory-mapped files. Mainly, it's a mix of these Win API functions:
Works on 64-bit OSs. Make sure to use 64-bit pointers etc.
03-15-2019 06:21 AM - edited 03-15-2019 06:26 AM
I have done it in this way:
1. create .NET DLL named LVHelper
2. insert .NET DLL in LabView and use provided Method(s)
See attached C# file
03-16-2019 01:57 PM
Hi EWiebe,
Thanks for the file. One question - how you compile this file into DLL, what compiler you used? In Visual Studio after compilation I can't see the functions listed in the DLL.
I tried https://www.nuget.org/packages/UnmanagedExports but still no success. Is there some existing DLL ready to use for x64 or is there hint how to compile it correctly? Thank you.
03-18-2019 03:12 AM
See attached Project
BR
EWiebe
03-18-2019 03:44 PM
Hi EWiebe,
Thank you for the project.
In Visual Studio 2013 I compiled successfully the project by removing everything connected with OfficeOpenXml (I'm not using it and and I don't have it on my computer) for target x64. The DLL is there but I can't see the functions listed in DLL - see snapshot from LabView where the function list in Call Library Function node is grayed out. Also attached a snapshot from the Visual Studio - compilation is OK.
Maybe the missing OfficeOpenXml has some functionality which makes the function calls published into the DLL.
In short - I can compile your project in VS 2013 and see the DLL but the functions were not exported (they are not visible in LV Call Library Function Node). Any suggestions what I'm doing wrong are really appreciated!
03-19-2019 03:38 AM - edited 03-19-2019 03:39 AM
You have a C# project, so it is a .NET DLL.
With the Call Library Node you can only access C/C++ DLLs
You need the .NET Conctructor Node:
03-20-2019 02:16 PM
Hi EWiebe,
Thank you so much for the help - the key moment was that this DLL is .NET and hence needs different way to deal with. Small details - big difference! I really appreciate your help!