Example Code

Trigger a LabVIEW User Event from Dynamic Link Library.

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW
  • Other

Code and Documents

Attachment

 

Overview
In many applications it may be necessary to communicate variable values or trigger LabVIEW events as a dynamic link library called by LabVIEW is still running.  One such way we can pass this information is by using event registration and a LabVIEW event reference to send data or triggers to the top level application from the called library.


Description
This example show cases the PostLVUserEvent function.  This function (defined by extcode.h) is responsible for posting an event with data that has been registered to a LabVIEW event structure.  The function TriggerLVEvents simply calls the PostLVUserEvent function 10 times and posts an integer that counts from 0-9. The LabVIEW VI calls this function when the user select the 'Execute DLL Event' button on the front panel.

 
Requirements

  • LabVIEW 2013 (or compatible)
  • Basic text editor to view code; LabWindows/CVI or other C IDE to build dll.
  • LabWindows/CVI Run Time 2013


Steps to Implement or Execute Code

  1. Open the LabVIEW VI titled 'Trigger LabVIEW Event From DLL 2013 NIVerified.vi'
  2. Run this VI
  3. Select the 'Execute DLL Event' button to call the dynamic link library

 

Additional Information or References
VI Block Diagram

1.png

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Cole R.
National Instruments
Software Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Imaginatics
Member
Member
on

Nice example.  Could you repost this in LabVIEW 2012 please?