Depuis plusieurs jours, je suis à la recherche d'un code pour afficher une barre de progression pour indiquer aux utilisateurs de patienter, l'upload est en cours.
Je ne cherche pas à avoir une barre de progression qui indique le % restant, mais tout simple (pour simplifier les choses) une barre qui défile de gauche à droite (et vis-et-versa...).
- Upload FTP du dossier fonctionne
- J'ai bien une barre demandant de patienter qui fonctionne (récupéré sur ce forum, très jolie d'ailleurs :))
- mais je n'arrive pas à faire fonctionner les 2 fonctions en même temps (l'un ou l'autre).
C'est bien sur le 3ème point que j'ai besoin de vous, par avance merci.
Pendant l'upload (fonction : _UploadFTP()), je désire afficher la barre de défilement (fonction : _SliderRight()).
Voici mon code actuel :
Code : Tout sélectionner
#include <FTPEx.au3>
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#include <ProgressConstants.au3>
#include <GUIConstants.au3>
HotKeySet("{ESC}", "endscript")
$Ca = GUICreate ( "" , 250 , 46 , -1 , -1 , $WS_POPUP,$WS_EX_TOPMOST+$WS_EX_WINDOWEDGE+$WS_EX_DLGMODALFRAME)
GUISetBkColor ( 0x000000 , $Ca )
$Da = GUICtrlCreateLabel (" Transfert en cours ...", 23, -1, 250,23)
GuiCtrlCreateGraphic(-1, 1, 252,45,$SS_SUNKEN)
GUICtrlSetColor(-1, 0XFFFFFF)
GUICtrlSetColor ( $Da, 0XFFFFFF)
GUICtrlSetFont ($Da, "12" , "50" , "" , "Courrier New")
GUICtrlCreateGraphic(1, 23, 250,20)
GUICtrlSetColor(-1, 0x007F00)
GuiSetState(@SW_SHOW)
$PID=0
_UploadFTP()
Func _UploadFTP()
$s_ServerName = 'mon_IP'
$s_Username = 'monlogin'
$s_Password = 'monMdP'
$sLocalFolder = '.\test'
$sRemoteFolder = 'test'
$bRecursivePut = '0'
$i_Passive = '1'
$l_InternetSession = _FTP_Open('MyFTP Control')
$hFTPSession = _FTP_Connect($l_InternetSession, $s_ServerName, $s_Username, $s_Password, $i_Passive)
_FTP_DirCreate ( $hFTPSession, $sRemoteFolder )
_FTP_DirPutContents ( $hFTPSession, $sLocalFolder, $sRemoteFolder, $bRecursivePut )
$Ftpc = _FTP_Close($l_InternetSession)
$PID=1
MsgBox($MB_SYSTEMMODAL, "Terminé", "Envoi de vos fichiers logs terminé")
EndFunc
Func _test()
$Passage=1
if $Passage=1 Then _SliderRight()
Return 1
EndFunc
Func _getmsg()
$Msg = GUIGetMsg()
If $Msg = $GUI_EVENT_CLOSE Then Exit
; Test du process. Si inexistant, on sort.
If $PID=1 Then endscript()
EndFunc
Func _SliderRight()
Local $newcolor,$color = 0x050000
For $m = 0 To 245 Step 5
$newcolor += $color
$ba = GUICtrlCreateLabel( "", $m, 25, 4,16)
GUICtrlSetBkColor($ba, $newcolor)
Sleep(50)
Next
_getmsg()
_SliderLeft()
EndFunc
Func _SliderLeft()
Local $backcolor,$color = 0x050000
For $m = 245 To 0 Step -5
$backcolor += $color
$ba = GUICtrlCreateLabel( "", $m, 25, 4,16)
GUICtrlSetBkColor($ba, $backcolor)
Sleep(50)
Next
_getmsg()
_SliderRight()
EndFunc
Func endscript()
Exit
EndFuncMerci,
Cdt,
Phifi



