DispatchMessage() static private method

Dispatches a window message so that the appropriate events can be invoked. This is used for the Taskbar's thumbnail toolbar feature.
static private DispatchMessage ( System.Windows.Forms.Message &m, TaskbarWindow taskbarWindow ) : bool
m System.Windows.Forms.Message The window message, typically obtained /// from a Windows Forms or WPF window procedure.
taskbarWindow TaskbarWindow Taskbar window for which we are intercepting the messages
return bool
        protected override void WndProc(ref Message m)
        {
            bool handled = TaskbarWindowManager.DispatchMessage(ref m, TaskbarWindow);

            // If it's a WM_Destroy message, then also forward it to the base class (our native window)
            if (((m.Msg == (int)WindowMessage.Destroy) ||
                 (m.Msg == (int)WindowMessage.NCDestroy) ||
                 ((m.Msg == (int)WindowMessage.SystemCommand) && (((int)m.WParam) == ScClose))) ^ !handled)
            {
                base.WndProc(ref m);
            }
        }
        protected override void WndProc(ref Message m)
        {
            var handled = false;

            if (TabbedThumbnail != null)
            {
                handled = TaskbarWindowManager.DispatchMessage(ref m, TabbedThumbnail.TaskbarWindow);
            }

            // If it's a WM_Destroy message, then also forward it to the base class (our native window)
            if ((m.Msg == (int)WindowMessage.Destroy) ||
                (m.Msg == (int)WindowMessage.NCDestroy) ||
                ((m.Msg == (int)WindowMessage.SystemCommand) && (((int)m.WParam) == TabbedThumbnailNativeMethods.ScClose)))
            {
                base.WndProc(ref m);
            }
            else if (!handled)
            {
                base.WndProc(ref m);
            }
        }