Exemplo n.º 1
0
 static public extern int Shell_NotifyIcon(NotifyCommand cmd, ref NOTIFYICONDATA data);
Exemplo n.º 2
0
        /// <summary>
        /// Function create struct which used Shell_NotifyIcon API function
        /// </summary>
        /// <param name="flags"></param>
        /// <returns></returns>
        private NOTIFYICONDATA CreateNotifyStruct( NotifyFlags flags, bool bSkip )
        {
            NOTIFYICONDATA data = new NOTIFYICONDATA();
              data.cbSize = (uint)Marshal.SizeOf( data );

              data.hWnd = m_handle;
              data.uID = m_id;

              data.uCallbackMessage = 0x400;
              data.uFlags |= flags;

              if( m_icon != null )
              {
            data.hIcon = m_icon.Handle; // this should always be valid
              }
              else
              {
            if( m_imgList != null && m_imgList.Images.Count > 0 )
            {
              Bitmap bmp = new Bitmap( m_imgList.Images[ 0 ], 16, 16 );
              data.hIcon = bmp.GetHicon();
            }
              }

              data.szTip = m_text;

              if( !bSkip )
              {
            if( !m_visible ) data.dwState = NotifyState.NIS_HIDDEN;
            data.dwStateMask |= NotifyState.NIS_HIDDEN;
              }

              return data;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Method remove/delete icon from tray
        /// </summary>
        private void Remove()
        {
            if( m_id != 0 )
              {
            // remove the notify icon
            NOTIFYICONDATA data = new NOTIFYICONDATA();
            data.cbSize = (uint)Marshal.SizeOf(data);

            data.hWnd = m_handle;
            data.uID = m_id;

            WindowsAPI.Shell_NotifyIcon( NotifyCommand.NIM_DELETE, ref data );
            m_id = 0;

            RefreshSystemTray();
              }
        }
Exemplo n.º 4
0
 public static extern int Shell_NotifyIcon( NotifyCommand cmd, ref NOTIFYICONDATA data );