Stack Exchange
Why overriding PreProcessMessage and WndProc of WebBrowser in hope to capture mouse clicks gives no effect?
I coded this junk:
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    class SmartWebBrowser : WebBrowser
    {
        private const int WM_LBUTTONDOWN = 0x0201;
        private const int WM_LBUTTONUP = 0x0202;
        private const int WM_LBUTTONDBLCLK = 0x0203;

        private const int WM_RBUTTONDOWN = 0x0204;
        private const int WM_RBUTTONUP = 0x0205;
        private const int WM_RBUTTONDBLCLK = 0x0206;

        private const int WM_MBUTTONUP = 0x0208;
        private const int WM_MBUTTONDOWN = 0x0209;

        public override bool PreProcessMessage(ref Message msg)
        {
            bool allow_propagation = true;

            switch (msg.Msg)
            {
                case WM_LBUTTONDOWN:
                case WM_LBUTTONUP:
                case WM_LBUTTONDBLCLK:
                case WM_RBUTTONDOWN:
                case WM_RBUTTONUP:
                case WM_RBUTTONDBLCLK:
                case WM_MBUTTONUP:
                case WM_MBUTTONDOWN:
                    allow_propagation = false; //breakpoint here
                    break;
            }

            if (allow_propagation)
                return base.PreProcessMessage(ref msg);
            else
                return false;
        }

        protected override void WndProc(ref Message msg)
        {
            bool allow_propagation = true;

            switch (msg.Msg)
            {
                case WM_LBUTTONDOWN:
                case WM_LBUTTONUP:
                case WM_LBUTTONDBLCLK:
                case WM_RBUTTONDOWN:
                case WM_RBUTTONUP:
                case WM_RBUTTONDBLCLK:
                case WM_MBUTTONUP:
                case WM_MBUTTONDOWN:
                    allow_propagation = false; //breakpoint here
                    break;
            }

            if (allow_propagation)
                base.WndProc(ref msg);
        }
    }
}

But breakpoints never trigger. What I doing wrong? Overriding WndProc for such things is common practice, but no work here.
I trying to stop clicks propagation to document, so user can scroll it, but can't interact with it via clicks.

It is not that simple, your WndProc() override is not the first one that gets the messages.   They get hijacked and passed to the document before you can see them.  Important, that keeps the Javascript in the html page functional.  You'd need a custom WebBrowserSite that overrides ISimpleFrameSite.PreMessageFilter().  I've heard of it being done, you got google keywords to search for.

@HansPassant - Thank you. Is is already answer on "Why", so make it as answer.

I don't want to support an answer like that for the rest of my natural life.  Post the actual solution you found and accept it as the answer to the question.

WM_MBUTTONDOWN is 0x0207

@HansPassant - for now I found nothing aside of this http://referencesource.microsoft.com/System.Windows.Forms/winforms/Managed/System/WinForms/WebBrowserSiteBase.cs.html#System.Windows.Forms/winforms/Managed/System/WinForms/WebBrowserSiteBase.cs and I trying to understand if this is what I need.

@stuartd - Thank you. You are attentive.
