Tuto WINDEV 25
Part 7: Advanced programming 423 Listing the files found on an FTP server FTPListFile is used to list the files found on an FTP server. This function is using a "callback" procedure. The procedure is run for each file or directory found. ▶ Display the WLanguage events associated with the "List" Button control in "WIN_FTP": 1. Select the "List" Button control. 2. Press F2 to display the associated WLanguage code: FTPListFile(gnConnectionID,"*.*", ... "CallBackFTPListFile", ftpFile+ftpDirectory) // Check the function execution IF ErrorOccurred THEN Error("Error while browsing the files found on the FTP server", ... ErrorInfo()) RETURN END 3. In the example, the procedure called is used to display the files found in a trace window. PROCEDURE CallBackFTPListFile(sFileName, nFileSize <useful>, ... sAttribute, sModifDate <useful>, sModifTime <useful>) // Is it a file or a directory IF sAttribute = "D" THEN // Directory or sub-directory Trace("Directory: " + sFileName) ELSE // File Trace("File: " + sFileName) END // Continue to browse the files RESULT True
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==