Jump to content

How to retrieve value from triggered event


Recommended Posts

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?

post-9524-1213201998.jpg?width=400

I checked and am positive that the event is triggered properly. But Event data out is still empty.

Link to comment

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.

Link to comment

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.

Link to comment

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.

Link to comment

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.

Link to comment

QUOTE (menghuihantang @ Jun 11 2008, 12:36 PM)

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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.