To download NI software, including the products shown below, visit ni.com/downloads.
This is a LabVIEW API for creating an icon in the Windows system tray (AKA notification area), complete with nested menus and events. It uses the .NET framework NotifyIcon class. While developing this, I found this similar implementation, but continued with my own to implement a few more features I required.
If you are looking around for a way to have a system tray icon for your LabVIEW application, as I was, you'll find that .NET is the way to go. You can try calling the Win32 API via Shell32.dll function Shell_NotifyIcon, but that is often difficult to do from LabVIEW directly. You will also have a very hard time getting events, such as mouse clicks on the icon or menus, back to LabVIEW. Another option is existing ActiveX wrappers people have made. NI has one that comes with CVI (posted here), and there are others around the web that are sometimes free but sometimes not (random example, random example, VI wrapped example). ActiveX gives a nice API and solves the event issue, but you are limited to the features that have been exposed to you through that particular ActiveX wrapper, which is up to the wrapper developer. However, .NET acting as the new Windows API gives a nice, featured interface that is easy to use from LabVIEW.
VIs are saved in LabVIEW 2009, and this was developed with .NET 3.5. I you have a different .NET version/requirement just give it a try. I would be surprised if this wasn't pretty backward/forward compatible.
Installation instructions: Download NotifyIcon.zip, then unzip to your user.lib folder and restart LabVIEW.
BUG FIX 4/5/2011 - Some LabVIEW references to objects were not being properly closed, though the objects themselves were being destroyed. This could cause a memory leak which would be noticable if you do a lot of icon or menu changing. NotifyIcon.zip has been updated to fix this. Thanks to DSmith for finding the issue. See the comment from DSmith below for more information.
Steps to Implement or Execute Code
Run either of the two examples included in the attachment for guidance on using this API.
LabVIEW 2009 or later
**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**Description-Separate-2
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.