menghuihantang Posted June 12, 2008 Report Share Posted June 12, 2008 Here is the problem. I have a DLL written in VB. A couples of events are available, such as Public event DataStreamSample (Sample As String) once this event is triggered, it returns sample derectly in which current state information is stored. But in Labview, I cannot get this returned sample directly. The following pic contains the code. Anyone has the idea how to retrieve the returned sample? I checked and am positive that the event is triggered properly. But Event data out is still empty. Quote Link to comment
ned Posted June 12, 2008 Report Share Posted June 12, 2008 QUOTE (menghuihantang @ Jun 11 2008, 12:36 PM) Here is the problem. I have a DLL written in VB. A couples of events are available, such as Public event DataStreamSample (Sample As String) once this event is triggered, it returns sample derectly in which current state information is stored. But in Labview, I cannot get this returned sample directly. The I checked and am positive that the event is triggered properly. But Event data out is still empty. I'm not certain, but I think your problem is that you've left the "User Parameter" input of the Register for Event node unwired. You need to wire something to that input, and it should match the type of the data you expect to be returned in the event. Quote Link to comment
menghuihantang Posted June 12, 2008 Author Report Share Posted June 12, 2008 QUOTE (ned @ Jun 11 2008, 11:41 AM) I'm not certain, but I think your problem is that you've left the "User Parameter" input of the Register for Event node unwired. You need to wire something to that input, and it should match the type of the data you expect to be returned in the event. Actually the data returned is in Event Data out. User parameter is optional, I did try wiring something to it. It doesn't work. I didn't get anything except empty string from the event. Quote Link to comment
jgcode Posted June 12, 2008 Report Share Posted June 12, 2008 QUOTE (menghuihantang @ Jun 12 2008, 12:56 AM) Actually the data returned is in Event Data out. User parameter is optional, I did try wiring something to it. It doesn't work. I didn't get anything except empty string from the event. This may help? QUOTE (NI) You must create a callback VI to handle events from Active X controls when the controls generate the registered event. The callback VI runs when the event occurs. To create the callback VI, right click the VI Ref input of the Register Event Callback function and select Create Callback VI form the shortcut menu. LabVIEW creates a reentrant VI. Open the VI end edit the BD to handle the event. Quote Link to comment
menghuihantang Posted June 12, 2008 Author Report Share Posted June 12, 2008 QUOTE (jgcode @ Jun 11 2008, 12:09 PM) This may help? Thanks. But... that's how those VIs come from. The problem is once the event is triggered, the event data out is supposed to be modified and returned. But I only got empty string. Something is wrong or missing, unfortunately I have no idea. Quote Link to comment
Thang Nguyen Posted June 12, 2008 Report Share Posted June 12, 2008 This is how you get data from callback VI Quote Link to comment
menghuihantang Posted June 12, 2008 Author Report Share Posted June 12, 2008 QUOTE (Thang Nguyen @ Jun 11 2008, 01:56 PM) This is how you get data from callback VI I know where the confusion is. I tried this too, the problem is in the source code (VB), whenever this event is triggered, it returns the result directly; however in Labview, because of no pass-by-reference stuff and data-flow, it seems not likely to retrieve the returned data. The answer seems to be not possible. Quote Link to comment
alukindo Posted June 12, 2008 Report Share Posted June 12, 2008 Hi: If you are using a *.DLL rather than an *.OCX ActiveX component you must initialize your reference using the VI code portion below. However, if you did that already then this should not be what is causing your problem Anthony Quote Link to comment
Rolf Kalbermatter Posted June 19, 2008 Report Share Posted June 19, 2008 QUOTE (menghuihantang @ Jun 11 2008, 12:36 PM) Here is the problem. I have a DLL written in VB. A couples of events are available, such as Public event DataStreamSample (Sample As String) once this event is triggered, it returns sample derectly in which current state information is stored. But in Labview, I cannot get this returned sample directly. The following pic contains the code. Anyone has the idea how to retrieve the returned sample? http://lavag.org/old_files/monthly_06_2008/post-9524-1213201998.jpg' target="_blank"> I checked and am positive that the event is triggered properly. But Event data out is still empty. Either I'm misunderstanding you or you are misunderstanding the event handling here. The data from the Event trigger is actually passed into the VI in "Event Data". If this parameter is by reference and the event is meant to pass some data back to the trigger function I would suppose your callback VI needing to supply this data back in "Event Data Out". There is no way you will ever see data from the event trigger source in "Event Data Out" since this is an indicator and meant to pass data back to the caller. Could it be that you did not understand that the Callback VI is invoked by the external event trigger but rather think it to be the event trigger itself? (Which would not make any sense by the way). Rolf Kalbermatter Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.