Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This function sends a message to the system to add, modify, or delete an icon from the taskbar status area.
WINSHELLAPI BOOL WINAPI Shell_NotifyIcon( DWORDdwMessage, PNOTIFYICONDATApnid );
- dwMessage
[in] Specifies the message value to send. The following table shows the possible values.Value Description NIM_ADD Adds an icon to the status area. NIM_DELETE Deletes an icon from the status area. NIM_MODIFY Modifies an icon in the status area. - pnid
[in] Pointer to a NOTIFYICONDATA structure. The content of the structure depends on the value of dwMessage.
Nonzero indicates success. Zero indicates failure.
The following code example demonstrates how to use Shell_NotifyIcon.
Note To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.
void Shell_NotifyIconExample()
{
// Add a Shell_NotifyIcon notificaion for PocketPC or Smartphone.
NOTIFYICONDATA nid = {0};
nid.cbSize = sizeof(nid);
nid.uID = 100; // Per WinCE SDK docs, values from 0 to 12 are reserved and should not be used.
nid.uFlags = NIF_ICON;
nid.hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SAMPLEICON));
// Add the notification to the tray.
Shell_NotifyIcon(NIM_ADD, &nid);
// Update the notification icon.
nid.uFlags = NIF_ICON;
nid.hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SAMPLEICON2));
Shell_NotifyIcon(NIM_MODIFY, &nid);
// Remove the notification from the tray.
Shell_NotifyIcon(NIM_DELETE, &nid);
return;
}
OS Versions: Windows CE 1.0 and later.
Header: Shellapi.h.
Standard Shell Functions | NOTIFYICONDATA
Send Feedback on this topic to the authors