Jump to content

_FTP_ProgressDownload showing always separate progress window.


t0nZ
 Share

Recommended Posts

When I upgraded from version 3.3.8.1 to the latest 3.3.12.0 I have the included functions _FTP_ProgressDownload and _FTP_ProgressUpload always showing a separate progress window, and not using the progress bar in the main gui.

This happens also with the example code from the Help :

#include <FTPEx.au3>
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <ProgressConstants.au3>

Global $g_sRemoteFile = "/pub/software/databases/rt/SRPMS/ucs-local-modperl-2.0.3-1.src.rpm"
Global $g_sLocalFile = @TempDir & "\temp.tmp"
FileDelete($g_sLocalFile)

Local $sServer = 'ftp.csx.cam.ac.uk'
Local $sUsername = ''
Local $sPass = ''

Local $hInternetSession = _FTP_Open('MyFTP Control')
; passive allows most protected FTPs to answer
Local $hFTPSession = _FTP_Connect($hInternetSession, $sServer, $sUsername, $sPass, 1)

Global $g_idProgressBarCtrl, $g_idBtn_Cancel
Example()

_FTP_Close($hInternetSession)

Func Example()
    ; create GUI
    GUICreate("My GUI download Progressbar", 220, 100, 100, 200)
    GUICtrlCreateLabel($g_sRemoteFile, 10, 10)
    $g_idProgressBarCtrl = GUICtrlCreateProgress(10, 40, 200, 20, $PBS_SMOOTH)
    GUICtrlSetColor(-1, 32250); not working with Windows XP Style
    $g_idBtn_Cancel = GUICtrlCreateButton("Cancel", 75, 70, 70, 20)
    GUISetState(@SW_SHOW)

    Local $sFunctionToCall = "_UpdateGUIProgressBar"
    _FTP_ProgressDownload($hFTPSession, $g_sLocalFile, $g_sRemoteFile, $sFunctionToCall)
EndFunc   ;==>Example

Func _UpdateGUIProgressBar($iPercent)
    GUICtrlSetData($g_idProgressBarCtrl, $iPercent)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit -1 ; _FTP_DownloadProgress Aborts with -1, so you can exit your app afterwards
        Case $g_idBtn_Cancel
            Exit -2 ; Just Cancel, without special Return value
    EndSwitch
    Return 1 ; Otherwise continue Download
EndFunc   ;==>_UpdateGUIProgressBar

And   #include <FTPEx.au3>  is the latest (June 1 2014)

In my system the result is like this https://www.dropbox.com/s/kg9q7c4rzhmzrjk/errorFTPprogress.JPG?dl=0

Why ?

Link to comment
Share on other sites

The UDF was updated to use a new feature that makes it possible to pass a sort of pointer of the function and call that. See "Function Notes" under Function Reference in the helpfile for how that works.

 

The change in the UDF is in the changelog, but apparently the examples was not updates at the stable release (they are fixed in the beta).

 

Removed: Usage of Call() in _FTP_ProgressDownload(), _FTP_ProgressUpload() and _SQLite_Startup(). See documentation for changes to $hFunctionCall and $hPrintCallback parameters. THIS IS A SCRIPT BREAKING CHANGE.

 

To fix, change "_UpdateGUIProgressBar" to _UpdateGUIProgressBar (notice the lack of quotes!).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...