02-25-2008 02:19 PM
02-25-2008 11:38 PM - edited 02-25-2008 11:39 PM
02-26-2008 12:58 AM - edited 02-26-2008 12:58 AM
02-26-2008 05:52 AM
Thank you kindly for your swift replies. I've ventured into MS Visual C# land to begin this work (trying to avoid too much baggage associated with C++ decorations, etc.). I think I'm about there. I am struggling with one aspect of this wrapper, though:
I need the wrapper to present the proper data types to the caller of the callback. However, once I've generated/converted the supplied data to data types that LabVIEW understands, I need to generate a UserEvent (the data is passed as a flattened string to the UserEvent). When I was using the App Builder to make the callback, this was not a problem. Now, I'm lost as to how to generate a LabVIEW UserEvent from within a C# or C++ environment? I'll start surfing the boards and see what I can find.
Thanks again for your help.
03-02-2008 05:32 PM
Hi Wiredup,
These links may help:
Using Callback Functions to Respond to User Interface Events
http://zone.ni.com/reference/en-XX/help/370051K-01/cvi/cviusing_callback_functions_to_resp/
Responding to Keypress Events on a Control
http://zone.ni.com/devzone/cda/epd/p/id/1979
Recognizing Events Passed from the User Interface to the Program
http://zone.ni.com/devzone/cda/epd/p/id/1871
03-04-2008 08:43 AM
Thank you. I had not seen that first reference link. It is very helpful.
I'm finding the easiest way to implement this wrapper is to write a C function that is exactly formatted to the structures specified by the API's callback. These functions simply call functions re-format the data into atomic/flattened/byte array structures that the LabVIEW can understand. Once reformatted, a second callback function is called that contains LabVIEW-generated code (like a user-event firing based when data is received). I'm simply using the App. Builder to make this second DLL.
In other words, when the API calls a callback function, the following data flow occurs:
API Function -->>
C-authored callback function -->> LabVIEW AppBuilder Generated Function -->> User Event with Flattened String containing data.
Not pretty, but it seems to work!