03-09-2005 12:44 PM - edited 03-09-2005 12:44 PM
Message Edited by Asif on 03-09-2005 12:48 PM
03-09-2005
03:14 PM
- last edited on
12-02-2025
02:48 PM
by
Content Cleaner
Asif,
The Devzone article [broken link removed] describes two methods to set occurrences from external code: 1) using Windows messaging and 2) using the Occur function. From your code it looks like you're trying to use both. So the first thing to do is pick the method you want to use.
The prototypes for GetLVAppWindHandle (which is only necessary for method 1) and Occur (which is only necessary for method 2) are given in the DevZone article and they appear to be correct in your code. You do need to link to labview.lib to use either.
Also, both PostMessage and Occur require as a parameter the occurrence you're trying to set. That occurrence needs to be created on the block diagram and passed to your DLL or CIN. In your code it's declared as type LVRefNum but not assigned a value.
Otherwise, it looks like you are on the right track.
Steven H.
03-09-2005
03:30 PM
- last edited on
12-02-2025
02:49 PM
by
Content Cleaner
@steven H. wrote:
Asif,
The Devzone article describes two methods to set occurrences from external code: 1) using Windows messaging and 2) using the Occur function. From your code it looks like you're trying to use both. So the first thing to do is pick the method you want to use.
The prototypes for GetLVAppWindHandle (which is only necessary for method 1) and Occur (which is only necessary for method 2) are given in the DevZone article and they appear to be correct in your code. You do need to link to labview.lib to use either.
Also, both PostMessage and Occur require as a parameter the occurrence you're trying to set. That occurrence needs to be created on the block diagram and passed to your DLL or CIN. In your code it's declared as type LVRefNum but not assigned a value.
Otherwise, it looks like you are on the right track.
Steven H.
Thanks for the reply, Steven.
Yes, I understand I only need to use one of the functions and that I will have to pass the correct values to the dll. The problem is that the code I attached can't FIND either function. I am getting "undefined reference to '_GetLVAppWindHandle'" and "undefined reference to '_Occur'" errors when I try to compile. Once I can get my code to find these functions, I will incorporate this code into an actual working application that receives the occurrence from LabVIEW, etc. (I have already written a .dll which LabVIEW calls with no problem)
I think the problem may be:
a) The documentation does not specify which library to use when compiling with gcc. It specifies labview.dll for Visual Studio which seems like the closest match to what I'm doing.
b) I may not be linking to the .llb correctly. (see my original post to see what commands I'm using)
Of course the problem may be something entirely different.
--
Asif
Message Edited by Asif on 03-09-2005 03:31 PM
03-09-2005 05:23 PM
03-10-2005 11:46 AM
@steven H. wrote:
Hmmm...you may be in uncharted waters here with gcc on Windows. I think labview.lib should still work, but I'm not familiar enough with gcc to know.
It should also be possible to call into labview.exe dynamically as the article discusses, so maybe that's another option for you.
Has anyone else used gcc on Windows to create CINs and/or link to one of the LabVIEW libraries?
Steven H.
03-10-2005 06:25 PM
03-11-2005 01:19 PM
@steven H. wrote:
I believe the DevZone documents may be incorrect in directing you to call GetModuleHandle. According to MSDN, you need to use LoadLibrary if you're loading an exe. You can use the resulting handle with GetProcAddress to get the address of GetLVAppWindHandle. I did some quick experiments and this seems to work. Let me know if you see the same.
Steven H.