HighTechTalks DotNet Forums  

Problems with Flash in WebBrowser

ASP.net Web Controls microsoft.public.dotnet.framework.aspnet.webcontrols


Discuss Problems with Flash in WebBrowser in the ASP.net Web Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
ljlevend2
 
Posts: n/a

Default Problems with Flash in WebBrowser - 01-11-2007 , 09:15 PM






I am having problems interacting with flash objects (i.e., Adobe Flash Player
9) in web pages when using a System.Windows.Forms.WebBrowser control. The
flash objects always seem to display correctly, but when I click on a link
within the flash object the WebBrowser often fails to navigate to the new
page. If I use IE6 (from outside by app) or an AxSHDocVw.AxWebBrowser
control (within my app) then everything works as expected.

You can try this out by creating an app with the following code:

Public Class Form1
Public Sub New()
InitializeComponent()
Me.Size = New Drawing.Size(600, 600)
Dim wb As New System.Windows.Forms.WebBrowser
wb.Dock = DockStyle.Fill
wb.Url = New System.Uri("http://www.falcon-nw.com/")
Me.Controls.Add(wb)
End Sub
End Class

On the web site that opens I can normally navigate to one of the links
(e.g., “WHAT’S NEW”). After that the page usually won’t navigate to any of
the other links.

I'm using Visual Basic 2005, .NET Framework 2.0, WinXP SP2.

Thanks for any help!
Lance


Reply With Quote
  #2  
Old   
Walter Wang [MSFT]
 
Posts: n/a

Default RE: Problems with Flash in WebBrowser - 01-12-2007 , 03:34 AM






Hi Lance,

This is a known issue of the .NET 2.0 WebBrowser control code. We're sorry
for the inconvenience caused. Here's the workaround for the WebBrowser
code: we need to inherit from the WebBrowser control and override its
WndProc to handle the mouse releated messages:

Public Class MyWebBrowser
Inherits System.Windows.Forms.WebBrowser

Const WM_LBUTTONDOWN As Integer = &H201
Const WM_RBUTTONDOWN As Integer = &H204
Const WM_MBUTTONDOWN As Integer = &H207
Const WM_MOUSEACTIVATE As Integer = &H21

Private Function FindContainerControl() As ContainerControl
Dim cc As ContainerControl = Nothing
Dim ctl As Control = Me
Do While Not ctl Is Nothing
Dim tempCC As ContainerControl = TryCast(ctl, ContainerControl)
If Not tempCC Is Nothing Then
cc = tempCC
Exit Do
End If
ctl = ctl.Parent
Loop
Return cc
End Function

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Select Case m.Msg
Case WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_MBUTTONDOWN,
WM_MOUSEACTIVATE
If Not DesignMode Then
Dim cc As ContainerControl = FindContainerControl()
If Not cc Is Nothing AndAlso Not cc.ActiveControl Is Me
Then
cc.Focus()
End If
End If
DefWndProc(m)
Case Else
MyBase.WndProc(m)
End Select
End Sub

End Class


I've tested it on my side using this customized WebBrowser control with the
URL you provided, it's working correctly. Please test it on your side and
let me know the result. Thanks.


Sincerely,
Walter Wang (wawang (AT) online (DOT) microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


Reply With Quote
  #3  
Old   
ljlevend2
 
Posts: n/a

Default RE: Problems with Flash in WebBrowser - 01-16-2007 , 09:54 PM



Hi Walter,

Thank you so much for your help. You understood my issue perfectly and your
suggestion was exactly what I needed. I am very grateful of your help!

Lance


Reply With Quote
  #4  
Old   
mwj69
 
Posts: n/a

Default Re: Problems with Flash in WebBrowser - 01-26-2007 , 01:59 PM




I found Walter's response on another site. Had to edit response to fit
character limitation so see link for entire response.

http://tinyurl.com/yu4gaj

Quote:
This is a known issue of the .NET 2.0 WebBrowser control code. We're
sorry
for the inconvenience caused. Here's the workaround for the WebBrowser

code: we need to inherit from the WebBrowser control and override its
WndProc to handle the mouse releated messages:

Public Class MyWebBrowser
Inherits System.Windows.Forms.WebBrowser

Const WM_LBUTTONDOWN As Integer = &H201
Const WM_RBUTTONDOWN As Integer = &H204
Const WM_MBUTTONDOWN As Integer = &H207
Const WM_MOUSEACTIVATE As Integer = &H21

Private Function FindContainerControl() As ContainerControl
Dim cc As ContainerControl = Nothing
Dim ctl As Control = Me
Do While Not ctl Is Nothing
Dim tempCC As ContainerControl = TryCast(ctl,
ContainerControl)
If Not tempCC Is Nothing Then
cc = tempCC
Exit Do
End If
ctl = ctl.Parent
Loop
Return cc
End Function

Protected Overrides Sub WndProc(ByRef m As
System.Windows.Forms.Message)
Select Case m.Msg
Case WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_MBUTTONDOWN,
WM_MOUSEACTIVATE
If Not DesignMode Then
Dim cc As ContainerControl =
FindContainerControl()
If Not cc Is Nothing AndAlso Not cc.ActiveControl
Is Me
Then
cc.Focus()
End If
End If
DefWndProc(m)
Case Else
MyBase.WndProc(m)
End Select
End Sub

End Class


--
mwj69


Reply With Quote
  #5  
Old   
seb
 
Posts: n/a

Default RE: Problems with Flash in WebBrowser - 12-16-2007 , 02:07 PM



Im sorry if i am digging up a old topic but i had the same error and found
this page thing is im new to visual basic so could some one explain how/where
i add that code


"Walter Wang [MSFT]" wrote:

Quote:
Hi Lance,

This is a known issue of the .NET 2.0 WebBrowser control code. We're sorry
for the inconvenience caused. Here's the workaround for the WebBrowser
code: we need to inherit from the WebBrowser control and override its
WndProc to handle the mouse releated messages:

Public Class MyWebBrowser
Inherits System.Windows.Forms.WebBrowser

Const WM_LBUTTONDOWN As Integer = &H201
Const WM_RBUTTONDOWN As Integer = &H204
Const WM_MBUTTONDOWN As Integer = &H207
Const WM_MOUSEACTIVATE As Integer = &H21

Private Function FindContainerControl() As ContainerControl
Dim cc As ContainerControl = Nothing
Dim ctl As Control = Me
Do While Not ctl Is Nothing
Dim tempCC As ContainerControl = TryCast(ctl, ContainerControl)
If Not tempCC Is Nothing Then
cc = tempCC
Exit Do
End If
ctl = ctl.Parent
Loop
Return cc
End Function

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Select Case m.Msg
Case WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_MBUTTONDOWN,
WM_MOUSEACTIVATE
If Not DesignMode Then
Dim cc As ContainerControl = FindContainerControl()
If Not cc Is Nothing AndAlso Not cc.ActiveControl Is Me
Then
cc.Focus()
End If
End If
DefWndProc(m)
Case Else
MyBase.WndProc(m)
End Select
End Sub

End Class


I've tested it on my side using this customized WebBrowser control with the
URL you provided, it's working correctly. Please test it on your side and
let me know the result. Thanks.


Sincerely,
Walter Wang (wawang (AT) online (DOT) microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.