Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Shell_NotifyIcon (shell32)
 
.
Summary
The Shell_NotifyIcon API

C# Signature:

[DllImport("shell32.dll")]
static extern bool Shell_NotifyIcon(uint dwMessage,
   [In] ref NOTIFYICONDATA pnid);

VB.NET Signature

<DllImport("shell32.dll")> _
Shared Function Shell_NotifyIcon(dwMessage as UInteger, ByRef pnid as NOTIFYICONDATA) as Boolean
End Function

User-Defined Types:

Here's the data structure for the NotifyIconData block, contributed by staff at http://www.softswift.com

    [StructLayout(LayoutKind.Sequential)]
    public struct NotifyIconData
    {
        public System.Int32 cbSize; // DWORD
        public System.IntPtr hWnd; // HWND
        public System.Int32 uID; // UINT
        public NotifyFlags uFlags; // UINT
        public System.Int32 uCallbackMessage; // UINT
        public System.IntPtr hIcon; // HICON
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst=128)]
        public System.String szTip; // char[128]
        public System.Int32 dwState; // DWORD
        public System.Int32 dwStateMask; // DWORD
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)]
        public System.String szInfo; // char[256]
        public System.Int32 uTimeoutOrVersion; // UINT
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst=64)]
        public System.String szInfoTitle; // char[64]
        public System.Int32 dwInfoFlags; // DWORD
        //GUID guidItem; > IE 6
    }

And then we noticed that the data structure is already provided elsewhere on this site but without a reference so here's the reference http://www.pinvoke.net/default.aspx/Structures.NOTIFYICONDATA

    public enum NotifyIconMessage : int
    {
        NIM_ADD      = 0x00000000,
        NIM_MODIFY       = 0x00000001,
        NIM_DELETE       = 0x00000002,
        NIM_SETFOCUS     = 0x00000003,
        NIM_SETVERSION   = 0x00000004,
    }

Notes:

Returns TRUE if successful, or FALSE otherwise. If dwMessage is set to NIM_SETVERSION, the function returns TRUE if the version was successfully changed, or FALSE if the requested version is not supported

None.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Alternative Managed API:

System.Windows.Forms.NotifyIcon

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions