Arcom IT
Focused on your business
Home About Contact
Guildford - 01483 505055
Shoreham - 0845 2414123


Rate this page

How would you rate the quality of this page?






Poor -> Excellent

(Optional)

Enabling Flash in the .NET 2.0 WebBrowser control.

Symptoms

When a .NET 2.0 application uses the System.Windows.Forms.WebBrowser control to load a page which contains a Flash movie, the movie may fail to respond to mouse events.

Cause

The WebBrowserBase.WndProc method sets the focus to the WebBrowser control when a mouse event is received.

Workaround

Create a new control derived from the WebBrowser control, and override the WndProc method:

using System;
using System.Windows.Forms;

public class WebBrowserEx : WebBrowser
{
    public WebBrowserEx()
    {
    }

    protected override void WndProc(ref Message m)
    {
        switch (m.Msg)
        {
            case 0x021:
            case 0x201:
            case 0x204:
            case 0x207:
                base.DefWndProc(ref m);
                return;
        }

        base.WndProc(ref m);
    }
}
References
Applies To:
  • .NET Framework 2.0

Last Reviewed: Friday, 8th December 2006
Keywords:

New Search