LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I build a dll containing a callback function ,the callback function is used in CVI.

Solved!
Go to solution
How about visa event/trigger/intrrupt for this work ?
0 Kudos
Message 11 of 14
(2,328 Views)
Solution
Accepted by topic author coolfire

coolfire wrote:
So now is there no way to complete this work ?

There is always a way. But sometimes you need to think outside of the box! Instead of callbacks you can also use Windows system events, if you have such a bad advrsery against polling. You can setup an event in CVI using Windows APIs, pass the handle to LabVIEW and using Windows APIs in LabVIEW too, trigger that event!

 

There are other ways imaginable where you write a DLL in CVI that provides an API function that can be called by LabVIEW through the Call Library Node and that in turn calls the callback function pointer LabVIEW passes to that function as one of the paramete. Just use your fantasy and think!

Message Edited by rolfk on 11-20-2009 11:38 AM
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 12 of 14
(2,321 Views)

rolfk 写:

There is always a way. But sometimes you need to think outside of the box! Instead of callbacks you can also use Windows system events, if you have such a bad advrsery against polling. You can setup an event in CVI using Windows APIs, pass the handle to LabVIEW and using Windows APIs in LabVIEW too, trigger that event!

 

There are other ways imaginable where you write a DLL in CVI that provides an API function that can be called by LabVIEW through the Call Library Node and that in turn calls the callback function pointer LabVIEW passes to that function as one of the paramete. Just use your fantasy and think!

Message Edited by rolfk on 11-20-2009 11:38 AM

Thanks!

 

I think there should be a way just like you said the first method,but  I  am not sure it and dont know how to do .Thank you for letting me make it clear. Are there examples for that "You can setup an event in CVI using Windows APIs, pass the handle to LabVIEW and using Windows APIs in LabVIEW too, trigger that event!" ? Now I do not know how to do specific.

 

Another,about the second method, is the main program must be running and generate  in the labview ?

0 Kudos
Message 13 of 14
(2,311 Views)
Look on MSDN for CreateEvent(), SetEvent(), WaitForSingelObject(), RegisterWaitForSingleObject() and CloseHandle() functions.
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 14 of 14
(2,308 Views)