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
03-09-2005 03:30 PM - edited 03-09-2005 03:30 PM
@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.
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.