Posting Events to a LabVIEW Event Structure From a Dll

Publish Date: Sep 06, 2006 | 3 Ratings | 3.67 out of 5 | Print | 5 Customer Reviews | Submit your review
This example demonstrates how to use an event structure to post a message and pass data to the event structure using the PostLVUserEvent() function. The VI calls the dll using the Call Library Function Node, and the dll passes three messages to the event structure. A dialog window displays the data and remains open for 2 seconds. The dll is called in its own thread so it does not hang the UI thread.

Back to Top

Customer Reviews
5 Reviews | Submit your review

C# Version  - Jan 4, 2015

Can you include an example of how to do this within C#? Basically, I have a C# code passing data to a memory mapped file and I want Labview to pick up the data. Now, there is a wonderful resource on VIPM by one ShaunR called MMAP that allows you to pick up data from a memory location but I need to raise an event callback for the LabVIEW program. I will appreciate your help. Thanks!

Exactly what was needed to retarget legacy "printf()" statements in C code into LabVIEW capturable messages without a huge rewrite.  - Mar 31, 2014

We were forced into "reuseing" some C code from a HW/SW Development Kit that was written in C on Linux, to be reasonably portable to other versions of linux, but not Windows. The code was filled with printf() statements, which would give us debug info, but would be a pain to remove/refactor later. I started looking into the PostLVUserEvent() function as a possible solution. The first examples I saw were for integers or clusters of integers. I tried editing the code for a LStr, but did not get to far. I recalled from the last time I did strings in CINs (a long time ago.. in a....) that there were some complications involved that were handled by copious quantities of LabVIEW Manager functions. Then I finally found this example. This fits the need exactly and probably saved me at least a couple days trying to wade through it on my own again. I do however agree with the request for more examples of data types. It would be helpful to marry this example with the one that shows multiple LabVIEW data types being called from a DLL. (LV Examples >> Communicating with External Applications >> Using External Code >> Integrating DLLs >> Call DLL.vi Thanks!

Cluster example  - Nov 29, 2011

There's an example showing a cluster with numerics here - http://lavag.org/topic/15229-how-to-call-postlvuserevent-with-a-cluster-of-scalars-from-c/page__view__findpost__p__91771

  - Sep 10, 2010

Why are these examples made for Visual C++ 6??? On a more recent version (VC++9) the project does not work.

  - Jun 7, 2010

This example only shows how to post string data to LabVIEW from an external dll. Should add examples for other data types (in particular arrays and clusters would be useful)

View more reviews

Bookmark & Share


Downloads

Attachments:

LVUserEvent.llb

Requirements


Ratings

Rate this document

Answered Your Question?
Yes No

Submit