Use code similar to this. Update your progress bar and or labels as you go.
WITH THIS
&& Call FtpOpenFile to get the file handle
hFTPFile = .FTPOpenFileF6(.cFileNameSource)
&& llReadSuccesss set to 1 to assume success
&& hDestinationFile is a file handle using FCREATE on local drive
llReadSuccess = 1
hFTPFile = .hFTPFile
hDestinationFile = FCREATE(lcDestinationFile)
liNumBytesToRead = .nBufferSIze
DO WHILE (llReadSuccess > 0) AND (hDestinationFile > 0)
lcBuffer = SPACE(.nBufferSize)
liNumBytesRead = 0
&& InternetReadFile has a Boolean response but coming from "C" type
&& libraries the value is a 0 or 1.
llReadSuccess = InternetReadFile(hFTPFile, @lcBuffer, liNumBytesToRead,
@liNumBytesRead)
IF (llReadSuccess > 0) AND (liNumBytesRead > 0)
=FWRITE(hDestinationFile,lcBuffer)
.nBytesRead = .nBytesRead + liNumBytesRead
ENDIF
ENDDO
=FCLOSE(hDestinationFile)
ENDWITH
Terry Rooks
Software Systems Architect
Microsoft Certified Solution Developer.Net
If at first you don't succeed, then skydiving definitely isn't for you.