AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Comunicación / Funciones Net
  • Example 1: Simple retrieval of a file
  • Example 2: Retrieving files and managing progress bars
NetGetFile (Example)
Example 1: Simple retrieval of a file
The following example is used to retrieve a file from the server and to copy it onto the client computer.
ConnectFTP is int
ConnectFTP = NetConnect("148.61.125.245", FTPServer, "GUEST", "")
...
NetGetFile(ConnectFTP, "C:\autoexec.bat", "C:\autoexec.cli")
Example 2: Retrieving files and managing progress bars
This example is used to retrieve the files found on an FTP server and to manage a progress bar. The window is called "MAIN". The progress bar is managed in this window.
// -- Opening code of window
// Request a message from Windows
GLOBAL
WM_MYMESSAGE is int
lpString is string fixed on 20 = "ProgBar_Main"
ConnectFTP is int
 
// Connection
ConnectFTP = NetConnect("148.61.125.245", FTPServer, "GUEST", "")
WM_MYMESSAGE = CallDLL32("USER32", "RegisterWindowMessageA", &lpString)
 
// Branch the ProgBar procedure on this message
Event("UPDProgBar", "MAIN", WM_MYMESSAGE)
// -- Code of button for file retrieval
HourGlass(True)
IF NetGetFile(ConnectFTP, "C:\autoexec.bat", ...
"C:\autoexec.cli", WM_MYMESSAGE, 10) = False THEN
Error("Error while transferring the file")
END
HourGlass(False)
// -- UPDProgBar() procedure
PROCEDURE UPDProgBar()
// Display the progress bar
// If the entire file is transferred, reinitialize the progress bar
IF _EVE.wParam = _EVE.lParam THEN
// Transfer completed
ProgressBar()
ELSE
// Transfer in progress
ProgressBar(_EVE.wParam, _EVE.lParam, "Transfer in progress")
END
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/05/2022

Señalar un error o enviar una sugerencia | Ayuda local