Jump to content

Sub VI Hangs at "Wait for event" invoke node - ActiveX code


Recommended Posts

Hi

I am facing a problem while running a sub VI.

I have developed a VI where I am calling windows system functions using ActiveX.

This vi will generate an event (in this sub VI it will come out from "wait for next event" with out error) whenever Ethernet cable is plugged or unplugged.

Once I run this vi it will wait at invoke node - "wait for next event". At this point I can't stop this sub VI even with abort button.

It's creating the problem in my application (application hangs).

Attached my VI. Please let me know if you need more information.

Thanks

Nesara

WMI_EVENT_Notification.vi

Link to comment

I notice that you have a time out set for 5 minutes. Are you saying that the VI will wait for 5 minutes and block everything or that it will never return from the Wait For Next Event.

Jason

Hi Jason

Yes VI will wait for 5 minutes and block everything. It will return from Wait for Next Event either after time out or after Ethernet plug/unplug event.

I can give less time out like 100 msec but application performance will reduce. I also learnt that since it is an external code LabView loses its execution control on it.

If I make this Sub VI as LabVIEW function block (yellow color blocks) then problem may solve. But pls let me know how do that.

Thanks

Nesara

Link to comment

If I make this Sub VI as LabVIEW function block (yellow color blocks) then problem may solve. But pls let me know how do that.

When you speak of a "yellow color block" I assume you speak about the built in functions in LabVIEW, and as a user you cannot really create built in functions.

The option for a user is to create a SubVI, but this will still not give you the option to abort the VI with the abort button.

Regarding the performance issue when you specify a smaller timeout, I think that you see a degradation in performance over time due to that you are not closing references, and because the stop node wont execute if the timeout error is propagated to its inputs.

To get even better speed you should initialize the event watcher, and only call the WaitForNotification in your loops (don't forget to close references afterwards).

Please have a look at the attached example, where this Init-Wait-Clear is used to increase performance.

WMI_EVENT_Example Folder.zip

/J

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.