The Old way:
The basic steps to using a tray icon via the windows API are:
- Load up the NOTIFYICONDATA structure
- Call Shell_NotifyIcon(NIM_ADD, &MyTrayNotifyStruct)
Changing the values of the fields in NOTIFYICONDATA and calling Shell_NotifyIcon allows you to change to icon or tool tip text or remove the icon itelf. All this messing around has been bundled in a class wrapper to make it easier and neater.
The Better way
The simpler way to add an icon to the system tray is to create an object of type CSystemTray either as a member variable or dynamically. Two forms of the constructor allow the programmer to insert the icon into the tray as the CSystemTray object is created, or by using the member function CSystemTray::Create. eg.
CSystemTray m_TrayIcon; // Member variable of some class
// in some member function maybe...
m_TrayIcon.Create(pParentWnd, WM_MY_NOTIFY, "Click here",
This will insert an icon in the system tray. See the following section for details.
check out example here