ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / Net functions
  • 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
PROCÉDURE 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
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help