|
|
|
|
- Example 1: Simple retrieval of a file
- Example 2: Retrieving files and managing progress bars
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
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|