如何在VB6中使用进度条下载多个文件? [英] How to download multiple files in VB6 with progress bar?

查看:13
本文介绍了如何在VB6中使用进度条下载多个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从 VB6 应用程序下载多个文件(主要是图像).目前我正在使用 URLDownloadToFile 但它一次只允许一个文件并且没有进度条.我想下载多个文件并带有进度条.请帮忙.提前致谢.

I want to download multiple files (mostly images) from VB6 application. presently i m using URLDownloadToFile but it allows only one file at a time and there is no progress bar. I want to download multiple files and with progress bar. please help. thanks in advance.

我现在的代码:

Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True

推荐答案

您希望异步下载文件,以便在下载发生时您的 VB 代码继续执行.一种鲜为人知的方法来使用原生 VB6 执行此操作,使用 AsyncRead 方法 - 无需 API 调用.

You want to download the file asynchronously, so that your VB code continues executing while the download happens. There is a little-known way to do this with native VB6, using the AsyncRead method of UserControl and UserDocument objects - no need for API calls.

这里有一个很好的 解释和用于多个同时下载的 VB6 代码,来自著名的 VB6 大师 Karl Peterson.AsyncReadProgress 事件为您提供 BytesRead 和 BytesMax,这将允许您显示进度条.

Here's an excellent explanation and VB6 code for multiple simultaneous downloads, from the renowned VB6 guru Karl Peterson. The AsyncReadProgress event gives you the BytesRead and BytesMax, which will allow you to display a progress bar.

这篇关于如何在VB6中使用进度条下载多个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆