/// <summary>
 ///
 /// </summary>
 public NotifyIcon()
 {
     messageWindow        = new NotifyIconMessageWindow(this);
     data.Size            = Marshal.SizeOf(data);
     data.CallbackMessage = WM_NOTIFY;
     data.Hwnd            = messageWindow.Hwnd;
     data.Flags           = NIF_MESSAGE;
 }
Example #2
0
 /// <summary>
 ///
 /// </summary>
 public NotifyIcon()
 {
     messageWindow = new NotifyIconMessageWindow(this);
     data.Size = Marshal.SizeOf(data);
     data.CallbackMessage = WM_NOTIFY;
     data.Hwnd = messageWindow.Hwnd;
     data.Flags = NIF_MESSAGE;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="disposing"></param>
 protected override void Dispose(bool disposing)
 {
     Visible = false;
     if (icon != null)
     {
         icon.Dispose();
         icon = null;
     }
     if (messageWindow != null)
     {
         messageWindow.Dispose();
         messageWindow = null;
     }
     base.Dispose(disposing);
 }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NotifyIcon"/> class.
        /// </summary>
        public NotifyIcon()
        {
#if !NDOC
            //create new messagewindow
            messageWindow = new NotifyIconMessageWindow(this);
#endif
            //create new array
            data        = new NOTIFYICONDATA();
            data.cbSize = Marshal.SizeOf(data);

            //write standard contents to data
            data.uID = id++;
            //write notification message
            data.uCallbackMessage = (int)WM.NOTIFY;
#if !NDOC
            data.hWnd = messageWindow.Hwnd;
#endif
            data.uFlags = NIF.MESSAGE;
        }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the NotifyIcon class.
        /// </summary>
        public NotifyIcon()
        {
#if !DESIGN
#if !NDOC
            //create new messagewindow
            m_msgwnd = new NotifyIconMessageWindow(this);
#endif
#endif
            //create new array
            m_data = new byte[152];

            //write standard contents to data array

            //write cbSize to the array
            BitConverter.GetBytes((int)m_data.Length).CopyTo(m_data, 0);


            //write id to the array
            BitConverter.GetBytes(id).CopyTo(m_data, 8);
            //increment id in case another icon is created
            id++;

            //write a default icon
            IntPtr hIcon = IntPtr.Zero;
            hIcon = ExtractIconEx(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase, 0, 0, ref hIcon, 1);
            BitConverter.GetBytes((int)hIcon).CopyTo(m_data, 20);

            //write flags
            BitConverter.GetBytes((uint)NotifyIconFlags.Icon).CopyTo(m_data, 12);

            //write notification message
            BitConverter.GetBytes((int)WM.NOTIFY).CopyTo(m_data, 16);

#if !DESIGN
#if !NDOC
            //write hWnd to the array
            BitConverter.GetBytes((int)m_msgwnd.Hwnd).CopyTo(m_data, 4);
#endif
#endif
        }
Example #6
0
		/// <summary>
		/// Initializes a new instance of the NotifyIcon class.
		/// </summary>
		public NotifyIcon()
		{
#if !DESIGN
#if !NDOC
			//create new messagewindow
			m_msgwnd = new NotifyIconMessageWindow(this);
#endif
#endif
			//create new array
			m_data = new byte[152];

			//write standard contents to data array

			//write cbSize to the array
			BitConverter.GetBytes((int)m_data.Length).CopyTo(m_data, 0);


			//write id to the array
			BitConverter.GetBytes(id).CopyTo(m_data, 8);
			//increment id in case another icon is created
			id++;

			//write a default icon
			IntPtr hIcon = IntPtr.Zero;
			hIcon = ExtractIconEx(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase, 0, 0, ref hIcon, 1);
			BitConverter.GetBytes((int)hIcon).CopyTo(m_data, 20);
			
			//write flags
			BitConverter.GetBytes((uint)NotifyIconFlags.Icon).CopyTo(m_data, 12);

			//write notification message
			BitConverter.GetBytes((int)WM.NOTIFY).CopyTo(m_data, 16);

#if !DESIGN
#if !NDOC
			//write hWnd to the array
			BitConverter.GetBytes((int)m_msgwnd.Hwnd).CopyTo(m_data, 4);
#endif
#endif
		}
Example #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="disposing"></param>
 protected override void Dispose(bool disposing)
 {
     Visible = false;
     if (icon != null)
     {
         icon.Dispose();
         icon = null;
     }
     if (messageWindow != null)
     {
         messageWindow.Dispose();
         messageWindow = null;
     }
     base.Dispose(disposing);
 }