Download a file, displaying progress bar

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Download a file, displaying progress bar

drtau
Is there any way in Dolphin to get it to download a file from
the Internet and display a progress bar for the download?  I
can use IStream, which works, but does not display a progress
bar for the download.  Thanks.


Reply | Threaded
Open this post in threaded view
|

Re: Download a file, displaying progress bar

Steve Waring-2
Hi drtau,

> Is there any way in Dolphin to get it to download a file from
> the Internet and display a progress bar for the download?  I

I have been able to do this in two ways. The first is by using the Web
Browser control to download the file I want. This has a status event
#onProgressChange:ProgressMax: which I hook up to a simple subclass of
ProgressDialog, which gives me the added benefit of being able to cancel the
operation. You can see this working in the applet at
http://www.chartexplorer.com/seti/applet.htm (once the applet is loaded,
click on "download").

The second method is by using the wininet library. I have been working on a
wrapping of this library, and I was about to ask if anybody was interested
in testing it. While I have not done an applet with http, I do have a toy
FTP client working as a demo applet with full status information.

If you are interested in testing this email me (swaring at ozemail dot com
dot au)

Thanks,
Steve


Reply | Threaded
Open this post in threaded view
|

Re: Download a file, displaying progress bar

drtau
Thanks Steve.  Can you elaborate some more on the Web Browser
control?  What class is that?  I couldn't find any senders of
#onProgressChange:ProgressMax: in my image.  Thanks.

Steve Waring wrote:

> Hi drtau,
>
> > Is there any way in Dolphin to get it to download a file from
> > the Internet and display a progress bar for the download?  I
>
> I have been able to do this in two ways. The first is by using the Web
> Browser control to download the file I want. This has a status event
> #onProgressChange:ProgressMax: which I hook up to a simple subclass of
> ProgressDialog, which gives me the added benefit of being able to cancel the
> operation. You can see this working in the applet at
> http://www.chartexplorer.com/seti/applet.htm (once the applet is loaded,
> click on "download").
>
> The second method is by using the wininet library. I have been working on a
> wrapping of this library, and I was about to ask if anybody was interested
> in testing it. While I have not done an applet with http, I do have a toy
> FTP client working as a demo applet with full status information.
>
> If you are interested in testing this email me (swaring at ozemail dot com
> dot au)
>
> Thanks,
> Steve


Reply | Threaded
Open this post in threaded view
|

Re: Download a file, displaying progress bar

Steve Waring-2
Hi drtau,

Try this;

control := AXControlSite progId: 'Shell.Explorer'.
control firesControlEvents: true.
control isTracingEvents: true. "This prints the events on the transcript"
webBrowser := control controlDispatch queryInterface: IWebBrowser2.
webBrowser navigate: 'http://www.amazon.com'

Once the navigation is complete, you can then ask the webBrowser interface,
for a "document". This answers an instance of IDispatch which you can again
use #queryInterface: on to get an interface which allows you to access the
document. I have typically used this to download HTML, so I have generated
some of the MSHTML interfaces, and to access this;

document := webBrowser document queryInterface: MSHTMLIHTMLDocument2

Check out; http://msdn.microsoft.com/workshop/browser/default.asp
It covers using both the WebBrowser control, and the document interfaces.

If you want to explore the WebBrowser control you can use the
WebBrowserShell. However, as the example above shows, it does not need to be
used visually.

> > operation. You can see this working in the applet at
> > http://www.chartexplorer.com/seti/applet.htm (once the applet is loaded,
> > click on "download").

Not a great example at the moment; apparently Seti's cable connection to the
internet was physically severed in a prank, and the server is unreachable
for a couple of days. (Hopefully you got a nice error message!)

Hope this helps, If you have any questions, please ask,
Steve


Reply | Threaded
Open this post in threaded view
|

Re: Download a file, displaying progress bar

drtau
Thanks again Steve - that's great!!  I really appretiate
the help.

Steve Waring wrote:

> Hi drtau,
>
> Try this;
>
> control := AXControlSite progId: 'Shell.Explorer'.
> control firesControlEvents: true.
> control isTracingEvents: true. "This prints the events on the transcript"
> webBrowser := control controlDispatch queryInterface: IWebBrowser2.
> webBrowser navigate: 'http://www.amazon.com'
>
> Once the navigation is complete, you can then ask the webBrowser interface,
> for a "document". This answers an instance of IDispatch which you can again
> use #queryInterface: on to get an interface which allows you to access the
> document. I have typically used this to download HTML, so I have generated
> some of the MSHTML interfaces, and to access this;
>
> document := webBrowser document queryInterface: MSHTMLIHTMLDocument2
>
> Check out; http://msdn.microsoft.com/workshop/browser/default.asp
> It covers using both the WebBrowser control, and the document interfaces.
>
> If you want to explore the WebBrowser control you can use the
> WebBrowserShell. However, as the example above shows, it does not need to be
> used visually.
>
> > > operation. You can see this working in the applet at
> > > http://www.chartexplorer.com/seti/applet.htm (once the applet is loaded,
> > > click on "download").
>
> Not a great example at the moment; apparently Seti's cable connection to the
> internet was physically severed in a prank, and the server is unreachable
> for a couple of days. (Hopefully you got a nice error message!)
>
> Hope this helps, If you have any questions, please ask,
> Steve