Поделиться через


Shell_NotifyIcon (Windows Embedded CE 6.0)

1/6/2010

This function sends a message to the system to add, modify, or delete an application-specific icon from the taskbar status area. **

Note

Icons created using Shell_NotifyIcon will disappear after the calling process exits. For an icon to survive beyond the timeframe of the calling process, it should be created through SHNotificationAdd.

Syntax

WINSHELLAPI BOOL WINAPI Shell_NotifyIcon(
  DWORD dwMessage, 
  PNOTIFYICONDATA pnid 
);

Parameters

  • 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.

Return Value

Nonzero indicates success. Zero indicates failure.

Code Example

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
    NOTIFYICONDATA nid = {0};
    nid.cbSize         = sizeof(nid);
    nid.uID            = 100;      // Per Windows Embedded CE 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;
}

Requirements

Header shellapi.h
Windows Embedded CE Windows CE 1.0 and later

See Also

Reference

Standard Shell Functions
NOTIFYICONDATA

Other Resources