LInetFtp::BrowseDir

#include "ltwrappr.h"

L_INT LInetFtp::BrowseDir(pszSearch = NULL)

L_TCHAR L_FAR *pszSearch;

/* valid directory path or file name */

Browses a specific directory or searches for a specific file on an FTP server's file system.

Parameter

Description

pszSearch

Character string that contains a valid directory path or file name for the FTP server's file system. The string can contain wildcards, but no blank spaces are allowed. If the value of pszSearch is NULL or if it is an empty string, it will find the first file in the current directory on the server. This is a NULL-terminated string.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

LInetFtp::BrowseCallBack function will be called automatically after calling LInetFtp::BrowseDir, to process the search/browse results. For more information about the information passed to the callback function, refer to LInetFtp::BrowseCallBack.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

LInetFtp::CreateDir, LInetFtp::DeleteDir, LInetFtp::GetCurrentDir, LInetFtp::ChangeDir, Class Members

Topics:

FTP Functions: Remote Directory Operations

 

How to Program with the LInetFtp Class

Example

//This example connects to an ftp server and browses a directory. If found it adds files to a list.
// The user should derive a class from LInetFtp to support the BrowseCallBack function
// suppose it was named as LUserInetFtp

class LUserInetFtp : public LInetFtp
{
   public:
      LUserInetFtp(L_TCHAR L_FAR *pszServer, L_TCHAR L_FAR *pszUserName = NULL,
      L_TCHAR L_FAR *pszPassword = NULL, L_INT nPort = 21);

   protected:
      virtual L_INT BrowseCallBack(L_TCHAR L_FAR *pszFile,       L_INT32 uFileAttrib,
      L_FILETIME ftCreateTime, L_FILETIME ftLastAccessTime,
      L_FILETIME ftLastWriteTime, L_UINT32 uFileSize);
};


L_VOID TestFunction(HWND hWndParent, L_TCHAR L_FAR *pszDirName)
{
   LUserInetFtp UserInetFtp(TEXT("www.leadtools.com"));

   // Checking if the connection failed
   if(UserInetFtp.GetErrorFromList () != SUCCESS)
   {
      UserInetFtp.DisplayError (hWndParent, TEXT("Can't connect to the FTP server"));
      return;
   }

   if(UserInetFtp.BrowseDir(pszDirName) != SUCCESS)
   {
      UserInetFtp.DisplayError(hWndParent, TEXT("Can't browse the remote directory"));
      return;
   }
}


LUserInetFtp::LUserInetFtp(L_TCHAR L_FAR *pszServer, L_TCHAR L_FAR *pszUserName, L_TCHAR L_FAR *pszPassword, L_INT nPort)
{
}

L_INT LUserInetFtp::BrowseCallBack(L_TCHAR L_FAR *pszFile, L_INT32 uFileAttrib, L_FILETIME ftCreateTime, L_FILETIME ftLastAccessTime, L_FILETIME ftLastWriteTime, L_UINT32 uFileSize)
{
   MessageBox(NULL, pszFile, TEXT("FTP Browsing"), MB_OK);
   return SUCCESS;
}