VB6 - Inet 挂起 - 多个表单实例
这是我的应用程序状态:
目的 - 从互联网下载多个列表文件 方法 - 创建一个简单的“下载表单”。一段时间后,我只需要更多表格,因为我有多个文件列表需要下载。刚刚解决了这个问题,方法是向我的项目添加一个 MDIform,添加一个按钮来创建另一个“下载表单”实例,然后瞧。显然,我的问题已经解决了。但是不:(
当我按下 form-instance3 中的“下载”按钮时,其他表单实例(2 和 1)会挂起下载内容(有时会超时),直到 form-instance3 终止所有下载,所以因此,即使我知道我的应用程序不是多线程的,同一表单的多个实例也会发生冲突(大概是 Inet 组件),并且我无法同时下载多个文件。 。 Inet 和我的下载功能在表单中定义。
我能做什么来解决这个问题?如何同时下载多个文件?
编辑:
我正在尝试使用“wqw”建议,但我面临一些问题: 在 download_form 中,我有一个 MSHFlexgrid,有 2 列:一列包含 URL,另一列包含文件名称。我正在迭代抛出所有行来下载文件并保存它们。使用“wqw”建议的方法,如何区分每个下载,以便可以使用网格中指示的正确名称保存它?
Here is my app status:
Purpose - download multiple list files from internet
Approach - created a simple "download form". After a while, I just needed more forms because I had more than one list of files to download. Just solved that by adding a MDIform to my project, add a button to create another "download form" instance and voilà. Apparently, my problem was solved. But no :(
When I press my "download" button in my form-instance3, the other form instances (2 and 1) hangs on downloading the contents (I get a timeout sometimes) until the form-instance3 terminates all the downloads and so on, for all the other forms. So, even though I know my app is not multi-threaded, the multiple instances of the same form are in conflict (Inet component, presumably) and I can't download multiple files at the same time.
Inet and my download function are defined in the form.
What can I do to solve this? how can I download multiple files at the same time?
edit:
I'm trying to use the "wqw" suggestion, but I'm facing some problems:
In the download_form, I have a MSHFlexgrid, with 2 columns: one with the URL and the other with the file destiny. I was iterating throw all rows to download the files and save them. With the approach suggested by "wqw", how can I distinguish each download so that I can save it with the properly name indicated in the grid?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你用什么来进行实际的http下载?我会尝试 简单异步下载 并忘记MDI 表格。真的吗!
What do you use for the actual http download? I would try Simple Asynchronous Downloads and forget about the MDIForm. Really!
VB6 本身是单线程的。因此,打破下载到不同的形式不会对你有帮助。
我过去使用的是 Timer 对象 与 ActiveX EXE。这种方法将使您能够将所有下载逻辑本地化在一个地方,像控制常规对象一样控制它并让它在单独的 EXE 中运行,从而默认情况下使其成为多线程。
因此,其工作方式如下:
VB6, on its own, is single threaded. So breaking out downloading to different forms won't help you.
What I've used in the past is the Timer object in conjunction with an ActiveX EXE. This approach will give you an ability to localize all the downloading logic in one place, control it like you control a regular object and have it run in a separate EXE, thus by default making it multi-threaded.
So the way this works is like so: