NOTIFYICONDATA (Structures)
Last changed: Mr Nick-86.153.65.78

.
Summary
Contains information that the system needs to process taskbar status area messages. Used in calls to Shell_NotifyIcon().

C# Definition:

struct NOTIFYICONDATA {
    /// <summary>
    /// Size of this structure, in bytes.
    /// </summary>
    public int cbSize;

    /// <summary>
    /// Handle to the window that receives notification messages associated with an icon in the
    /// taskbar status area. The Shell uses hWnd and uID to identify which icon to operate on
    /// when Shell_NotifyIcon is invoked.
    /// </summary>
    public IntPtr hwnd;

    /// <summary>
    /// Application-defined identifier of the taskbar icon. The Shell uses hWnd and uID to identify
    /// which icon to operate on when Shell_NotifyIcon is invoked. You can have multiple icons
    /// associated with a single hWnd by assigning each a different uID.
    /// </summary>
    public int uID;

    /// <summary>
    /// Flags that indicate which of the other members contain valid data. This member can be
    /// a combination of the NIF_XXX constants.
    /// </summary>
    public int uFlags;

    /// <summary>
    /// Application-defined message identifier. The system uses this identifier to send
    /// notifications to the window identified in hWnd.
    /// </summary>
    public int uCallbackMessage;

    /// <summary>
    /// Handle to the icon to be added, modified, or deleted.
    /// </summary>
    public IntPtr hIcon;

    /// <summary>
    /// String with the text for a standard ToolTip. It can have a maximum of 64 characters including
    /// the terminating NULL. For Version 5.0 and later, szTip can have a maximum of
    /// 128 characters, including the terminating NULL.
    /// </summary>
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst=128)]
    public string szTip;

    /// <summary>
    /// State of the icon.
    /// </summary>
    public int dwState;

    /// <summary>
    /// A value that specifies which bits of the state member are retrieved or modified.
    /// For example, setting this member to NIS_HIDDEN causes only the item's hidden state to be retrieved.
    /// </summary>
    public int dwStateMask;

    /// <summary>
    /// String with the text for a balloon ToolTip. It can have a maximum of 255 characters.
    /// To remove the ToolTip, set the NIF_INFO flag in uFlags and set szInfo to an empty string.
    /// </summary>
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)]
    public string szInfo;

    /// <summary>
    /// NOTE: This field is also used for the Timeout value. Specifies whether the Shell notify
    /// icon interface should use Windows 95 or Windows 2000
    /// behavior. For more information on the differences in these two behaviors, see
    /// Shell_NotifyIcon. This member is only employed when using Shell_NotifyIcon to send an
    /// NIM_VERSION message.
    /// </summary>
    public int uVersion;

    /// <summary>
    /// String containing a title for a balloon ToolTip. This title appears in boldface
    /// above the text. It can have a maximum of 63 characters.
    /// </summary>
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst=64)]
    public string szInfoTitle;

    /// <summary>
    /// Adds an icon to a balloon ToolTip. It is placed to the left of the title. If the
    /// szTitleInfo member is zero-length, the icon is not shown. See
    /// <see cref="BalloonIconStyle">RMUtils.WinAPI.Structs.BalloonIconStyle</see> for more
    /// information.
    /// </summary>
    public int dwInfoFlags;
}

C# Class Definition:

using System.Runtime.InteropServices

[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
public class NOTIFYICONDATA
{
    public int cbSize = Marshal.SizeOf(typeof(NOTIFYICONDATA));
    public IntPtr hWnd;
    public int uID;
    public int uFlags;
    public int uCallbackMessage;
    public IntPtr hIcon;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst=0x80)]
    public string szTip;
    public int dwState;
    public int dwStateMask;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst=0x100)]
    public string szInfo;
    public int uTimeoutOrVersion;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst=0x40)]
    public string szInfoTitle;
    public int dwInfoFlags;
}
//usage - cbSize is assigned
NOTIFYICONDATA nid = new NOTIFYICONDATA();

VB Definition:

    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> Structure NOTIFYICONDATA
    Dim cbSize As Integer
    Dim hWnd As IntPtr
    Dim uID As Integer
    Dim uFlags As Integer
    Dim uCallbackMessage As Integer
    Dim hIcon As IntPtr
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> Dim szTip As String
    Dim dwState As Integer
    Dim dwStateMask As Integer
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Dim szInfo As String
    Dim uTimeout As Integer ' ignore the uVersion union
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Dim szInfoTitle As String
    Dim dwInfoFlags As Integer
    Dim guidItem As Guid
    End Structure

User-Defined Field Types:

None.

Notes:

The C# Structure above is commented for automatic XML documentation.

Documentation