Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

NI::CNiSystemTrayIcon

Hello

Yesterday I tried to add system tray icon to my C++ (MFC, MS Visual Studio 7.1.3088) application. NI::CNiSystemTrayIcon class provides this, so I thought it will be easy. Well, maybe it is, but not for me :-). I found out that even adding the following line:
NI::CNiSystemTrayIcon system_tray_icon;
to my CWnd - derived main window class (sidenote: I'm using MFC but not Document/View, MDI or other MS inventions, just plain MFC CWnd and my own derived classes) causes assertion failure on application startup. Please note that I don't call any methods on this class (except constructor, which of course gets called automatically) and yet it causes assertion failure!
I also tried to create NI::CNiSystemTrayIcon dynamically, using operator new, when my main window gets created (just after Create returns).
That causes assertion failure, too, when application is run in debug mode (traced). No assertion failure occurs if I just run executable file (debug version, but run independently), thought.

My question is: how to use CNiSystemTray icon properly? What I'm doing wrong?

Best regards
Michal
0 Kudos
Message 1 of 2
(3,095 Views)
Hi Michal,

There is an example using CNiSystemTrayIcon that is installed with Measurement Studio. I would recommend taking a look at this example, seems like that is exactly what you're looking for. The example is located at

C:\Program Files\National Instruments\MeasurementStudio\VC\Examples\Utility\SimpleSystemTrayIcon

I hope this helps.

SijinK
National Instruments.
0 Kudos
Message 2 of 2
(3,090 Views)