Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 3rd, 2007, 08:32 AM
Registered User
 
Join Date: Nov 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Some doubts about WebBrowser Control

hi,
 My first post :).
 I am working on an application, which has a webbrowser control on one of the forms. The user is directed to a web address. If the user downloads a file from there(.zip,.rar), a "Save file" dialog(same as that of IE) pops up. I want the total information about the download in my application, and not this pop-up window. I am not using HTTPWebRequest due to a simple reason that I am not sure of the URL of the download.
 I was successful in showing the progress via ProgressChange event, when the user browses the webpages, but during the download(i.e the pop-up window), the progress is unknown.How can i avoid that pop-up and instead show everydetail in the application?Also save the file to a pre-specified location,I have already tried Webclient class.
Any help appreciated :)

 
Old November 3rd, 2007, 11:08 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

It is doable, but I suspect you will have to inject some events into the web browser to capture each click. See the beow link for details about hookinh up a webbrowser control and client code.

http://msdn2.microsoft.com/en-us/library/a0746166(VS.80).aspx

/- Sam Judson : Wrox Technical Editor -/
 
Old November 3rd, 2007, 09:42 PM
Registered User
 
Join Date: Nov 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Sam,
 I saw the link. The things that they have shown, i.e invoking scripts etc., I have been using them all along and i dont get it how it will help in solving my problem? I have tried all the things that I know, or could find through google. If someone could explain the processes or events that leads to the pop-up "Save File" dialog in a webBrowser, it might be a li'l easier for me to think in a correct direction.
Thanks.

 
Old November 5th, 2007, 10:47 AM
Registered User
 
Join Date: Nov 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, i think i have made some progress.. i found this, and it is exactly what I need to make.

http://msdn2.microsoft.com/en-us/library/aa753618.aspx

But I am not sure how to proceed.. due lack of example , I am clueless!
can someone help me?

 
Old November 5th, 2007, 11:31 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

How about looping through each HtmlElement returned by webBrowser.Document.GetElementByTagName("a") and handling the Click event.

Then in the Click event handler check the href attribute. If it is the file you want then do the download manually and set e.ReturnValue to false, otherwise set it to true.

/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Webbrowser control mussie C# 2005 1 March 2nd, 2010 01:10 PM
Loading HTML into WebBrowser control osemollie Pro VB Databases 7 August 17th, 2006 03:12 PM
Implement of Interface of webbrowser control vickyj Visual C++ 0 January 18th, 2006 07:15 AM
change page encoding in WebBrowser ActiveX control alexxx_ltd Visual C++ 2 December 16th, 2004 07:08 PM
WebBrowser control atingoldy Beginning VB 6 1 June 16th, 2003 06:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.