Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 774
  • Last Modified:

WebBrowser on window.close

At last Microsoft have acknowledged the problem exists (even if it's not considered a bug) and offered a pretty basic C# solution.

http://support.microsoft.com/kb/253219/en-us

Does anybody know how to implement this in VB.Net?
0
thefritterfatboy
Asked:
thefritterfatboy
1 Solution
 
doobdaveCommented:
Hi there,

That's really interesting, I remember I was having that 'unexpected behaviour' when developing an app with the WebBrowser, a while ago, and I never got to the bottom of it.
I remeber our client was fuming that we could not resolve the issue.

I like the way M$ just call it a 'problem (PRB)' like it's really no big deal!!

I'm afraid I can't help you in translating that code to VB.NET (it's in C++, by the way, not C#), though I'd be interested to see what it looks like if someone else replies.

Good Luck!

David
0
 
Bob LearnedCommented:
Try putting this in the form:

  Protected Overrides Sub OnNotifyMessage(ByVal m As System.Windows.Forms.Message)

  End Sub

Put a breakpoint, and see if it is reached.

Bob
0
 
thefritterfatboyAuthor Commented:
No joy :(

I was using this:

Protected Overrides Sub WndProc(ByRef m As Message)
     debug.writeLine(m.msg.tostring)
End Sub

And trying to find a unique message. Supposedly - I should get a WM_DESTROY message, but I swear I can't find it either on the parent form or if I create a class that inherits the webbrowser and override the WndProc there. So I just tried to find a message that was unique to when the window closes. There are none. I wouldn't dare look for a unique lParam and Wparam aswell!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Bob LearnedCommented:
What .NET version are you working with?

Bob

0
 
thefritterfatboyAuthor Commented:
.Net 2 in Visual Studio 2005
0
 
thefritterfatboyAuthor Commented:
Any more ideas for this?
0
 
Bob LearnedCommented:
Nope.
0
 
thefritterfatboyAuthor Commented:
Just a note to the CleanUp volunteers - please don't close this yet. I haven't forgotten it!

I raised a support request with Microsoft (first time ever!) and the developer there says he has recreated the issue. Hopefully we'll find a fix or a workaround soon that I will post back here.

This issue has been driving me insane. Slowly but surely.
0
 
thefritterfatboyAuthor Commented:
Please do not close this question. The last response from Microsoft was:

This issue is caused by a bug in the Managed webbrowser control. The windowclosing event does not fire for the managed webBrowser control. A bug has been filed on this issue. The developer group for Visual Studio said that they are planning to fix this in post service pack release on which we do not have a release date yet.

We are looking for a workaround in C# (or VB). Are you working in C# or VB.NET?



I think we're close to an answer.
0
 
Bob LearnedCommented:
I work in both VB.NET and C#.

Bob
0
 
thefritterfatboyAuthor Commented:
It has been 8 days since my last response - I'm pretty sure that means this topic is not abandoned.

The VB or C# question was posed to me by Microsoft Support, it wasn't intended as a question for you, sorry if it seemed this way.

I would like this question to be kept open because if a workaround is found it will be of great importance, I'm sure, for other developers using the managed WebBrowser component.
0
 
thefritterfatboyAuthor Commented:
Microsoft response:

The windowclosing event does not fire for the managed webBrowser control. I have
filed a bug on this issue. The work around would be to use the axWebBrowser com
component.

I have contacted the dev group on this issue and they told me that they are
planning to fix this in post service pack release on which we do not have a
release date yet.



I will work with the sample they have sent to create a sample in VB.Net, when complete I will post back a solution here. The C# sample works perfectly (obviously with a different component - but still!)
0
 
CetusMODCommented:
PAQed with points refunded (500)

CetusMOD
Community Support Moderator
0
 
grhindCommented:
Hey fritterfratboy did you ever get a code example that worked with vb.net webbrowser control?
0
 
thefritterfatboyAuthor Commented:
No, never got a workaround or code example from the internet / Microsoft. The key to getting this working is wrapping the IE ActiveX objects yourself, rather than using the managed web browser control. This, however, presents new problems such as the one highlighted here:

http://www.codeproject.com/KB/vb/extended_webbrowser.aspx

Unfortunately, this issue was not fixed in .Net 3 alpha and beta builds and I've not tested to see if it works in .Net 3.5
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now