The new vbAccelerator Site - more VB and .NET Code and Controls
Source Code
5 Internet &nbsp
 

Asynchronous Transfer Component

 
 

Download files and data asynchronously from the Internet

 
 


Get Downloading


Download Code
Download the VB6 Asynchronous Transfer DLL and Demonstration Project (16kb)
Download VB5 Binary Asynchronous Transfer DLL (9kb)

 

&nbsp
Overview
Proving that things don't have to be complicated to be really useful, this ActiveX DLL from Dion Wiggins (dionwiggins@hotmail.com) allows you to manage as many asynchronous data downloads from the Internet as you want. Code is provided in VB6 format, but is compatible with VB5 and can quite easily be loaded (ignore any errors thrown by VB5 and delete the lines which cause an error!) A VB5 binary is also provided in case you have problems.

Description
This DLL performs asynchronous transfers from the net. There is no limit to the number of transfers that it can do at once, so long as the key you pass is unique.

The DLL is implemented as a wrapper to an invisible form which contains a single instance of a private usercontrol. Usercontrols have a lot of this functionality already built in, and it is a simple case of wrapping it to make it work as a DLL.

The included demo application transfers a vbAccelerator logo 50 times.

Coding with the DLL
There is one Method:

   DownloadFile( _
       ByVal strFileKey As String, _
       ByVal strPath As String, _
       ByVal lngFileType As enumDownloadFileTypes, _
       ByVal strData As String) As Boolean

If the transfer is started successfully then True is returned, otherwise False. An error may be raised by the control if you are not connected to the Internet (see Determining Whether There is an Internet Connection).

  • strFileKey must be unique within the currently transferring files. If a file has completed transferring, then the key can be reused.
  • strPath is the URL of the file to transfer
  • lngFileType must be one of the values exposed by enumDownloadFileTypes
  • strData can be any string, and is simply passed back when the events are triggered.
There is one enum:

   Public Enum enumDownloadFileTypes
       dftFile = 1
       dftPicture = 2
       dftPicture16 = 3
       dftPicture32 = 4
       dftByteArray = 5
   End Enum


And there are two events:

   Event FileReadComplete( _
       ByVal strFileKey As String, _
       ByVal lngFileType As enumDownloadFileTypes, _
       AsyncProp As AsyncProperty, _
       ByVal strData As String)

   Event FileReadProgress( _
       ByVal strFileKey As String, _
       ByVal lngFileType As enumDownloadFileTypes, _
       AsyncProp As AsyncProperty, _
       ByVal strData As String)

The values for both events are the same, and the AsyncProp object is documented in Visual Basic by the AsyncProperty object.



TopBack to top
Source Code - What We're About!Back to Source Code

&nbsp
 

About  Contribute  Send Feedback  Privacy

Copyright © 1998-1999, Steve McMahon ( steve@vbaccelerator.com). All Rights Reserved.
Last updated: 30 June 1999