PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Example: Transferring a file and managing a progress bar
  • Example: Transferring a directory to the root of an FTP account and managing a progress bar
  • Example: Transferring a file and managing a progress bar (WINDEV Mobile)
Example: Transferring a file and managing a progress bar
WINDEVReports and QueriesJavaUser code (UMC)
This example sends a file from the current computer to the FTP server. The Transfer_Progress procedure is used to manage the progress of the transfer in the current window, displayed on the current computer.
nConnection is int
nConnection = FTPConnect("ftp.cdrom.com", "GUEST", "")

IF FTPSend(nConnection, "C:\autoexec.bat", "/autoexec.tmp", "Transfer_Progress") = False THEN
  Info("The transfer failed")
END
// -- ProgBar_Transfer procedure: managing the current transfer
PROCEDURE Transfer_Progress(nTotal, nCurrent)
Message("Transfer in progress...")
Gauge(nCurrent, nTotal)
// Is the transfer completed?
IF nCurrent = nTotal THEN
Message("Transfer completed")
Info("Transfer completed")
END
RESULT True
Example: Transferring a directory to the root of an FTP account and managing a progress bar
WINDEVReports and QueriesJavaUser code (UMC)
This example is used to send a full directory found on the current computer to the FTP server. The ManageProgress procedure is used to manage the progress of the transfer in the current window, displayed on the current computer.
HourGlass()
ResSend is boolean
ResConnect is int = FTPConnect(sAddressFTPServer,"MyFTPAccount","MyPassword",21, False)
IF ResConnect = -1 THEN
HourGlass(False)
Error("Connection error: " + CR + ErrorInfo())
RETURN
END

// Connection successful: sending the gallery
// FTPMakeDir(ResConnect,"/"+TABLE_Galleries.Gallery_Name)
ResSend = FTPSend(ResConnect, CompleteDir(LocalDirectoryOfGalleries) +  ...
TABLE_Galeries.Gallery_Name, ...
"/", "ManageProgress", ftpBinaryMode)

IF ResSend = False THEN
HourGlass(False)
Error("Error while sending the gallery: " + CR + ErrorInfo())
RETURN
END

FTPDisconnect(ResConnect)
Gauge()
HourGlass(False)
Info("Gallery transferred")
// -- ManageProgress procedure: managing the current transfer
PROCEDURE ManageProgress(nTotal_size, nTransferred_size)

Gauge(nTransferred_size, nTotal_size, "Transferring the gallery...", PastelRed)
RESULT True
Example: Transferring a file and managing a progress bar (WINDEV Mobile)
Windows Mobile
This example is used to send a file from the current computer (Mobile) to the FTP server. The Transfer_Progress procedure is used to manage the progress of the transfer in the current window, displayed on the current computer.
nConnection is int
nConnection = FTPConnect("ftp.cdrom.com", "GUEST", "")

IF FTPSend(nConnection, "\autoexec.bat", "/autoexec.tmp", "Transfer_Progress") = False THEN
Info("The transfer failed")
END
// -- ProgBar_Transfer procedure: managing the current transfer
PROCEDURE Transfer_Progress(nTotal, nCurrent)
Message("Transfer in progress...")
Gauge(nCurrent, nTotal)
// Is the transfer completed?
IF nCurrent = nTotal THEN
Message("Transfer completed")
Info("Transfer completed")
END
RESULT True
Minimum required version
  • Version 9
This page is also available for…
Comments
FTPSEND
s_arquivo_endereco_local is string=ftp_conf.endereco_local+TABLE_local.COL_nome_arquivo // "d:\erpmatos\Atualizacao\matosnfe.jpg"
s_arquivo_endereco_remoto is string=ftp_conf.endereco_remoto+TABLE_local.COL_nome_arquivo // "/web/_Windev_Erp_matos/matosnfe.jpg"
// TRANSFERENCIA
IF FTPSend(n_conexao,s_arquivo_endereco_local,s_arquivo_endereco_remoto,_transferencia) = False THEN
Info("erro transferencia")
END
// TRANSFERENCIA
// ESSA PROCEDURE ESTA LINKADA AO FTPSEND
PROCEDURE _transferencia(nTotal, nCurrent)
Gauge(nCurrent,nTotal) // vai gerar uma barra de progresso status
// tem de estar com status de mensagem na windows ativa
RESULT True
De matos AMARILDO
Jan. 04 2016