p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C# 2005 (http://p2p.wrox.com/forumdisplay.php?f=138)
-   -   Some doubts about WebBrowser Control (http://p2p.wrox.com/showthread.php?t=63495)

Xc0d November 3rd, 2007 08:32 AM

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 :)


samjudson November 3rd, 2007 11:08 AM

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 -/

Xc0d November 3rd, 2007 09:42 PM

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.


Xc0d November 5th, 2007 10:47 AM

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?


samjudson November 5th, 2007 11:31 AM

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 -/


All times are GMT -4. The time now is 01:01 AM.

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