System Tray

System Tray

Can you program C++ to allow a program run in the system tray (next to the clock) like VB? If so, is there sample code somewhere?

This task is easier to do in C than it is in VB. Unfortunately, the code to do this is a little long to fit here.

Basically, you should use the Shell_NotifyIcon API function to add, modify, and remove icons from the system tray (or taskbar notification area). This function takes two arguments: either NIM_ADD, NIM_DELETE, or NIM_MODIFY to indicate the action you want to take, and a pointer to a NOTIFYICONDATA structure that specifies the icon and other information about the icon you are placing on the taskbar.


Share the Post: