If you specify a callback message for a taskbar icon, the system sends the message to your application whenever a mouse event occurs in the icon's bounding rectangle. The wParam parameter specifies the identifier of the taskbar icon, and the lParam parameter specifies the mouse message that the system generated as a result of the mouse event.
The function in the following example is from an application that adds both battery and printer icons to the taskbar. The application calls the function when it receives a callback message. The function determines whether the user has clicked one of the icons and, if a click has occurred, calls an application-defined function to display status information.
// On_MYWM_NOTIFYICON - processes callback messages for taskbar icons
// wParam - first message parameter of the callback message
// lParam - second message parameter of the callback message
void On_MYWM_NOTIFYICON(WPARAM wParam, LPARAM lParam)
{
UINT uID;
UINT uMouseMsg;
uID = (UINT) wParam;
uMouseMsg = (UINT) lParam;
if (uMouseMsg == WM_LBUTTONDOWN) {
switch (uID) {
case IDI_MYBATTERYICON:
// The user clicked the battery icon. Display the
// battery status.
ShowBatteryStatus();
break;
case IDI_MYPRINTERICON:
// The user clicked the printer icon. Display the
// status of the print job.
ShowJobStatus();
break;
default:
break;
}
}
return;
}