LInetFtp::BrowseDir
#include "ltwrappr.h"
L_INT LInetFtp::BrowseDir(pszSearch = NULL)
L_TCHAR *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 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: |
|
|
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 *pszServer, L_TCHAR *pszUserName = NULL, L_TCHAR *pszPassword = NULL, L_INT nPort = 21); protected: virtual L_INT BrowseCallBack(L_TCHAR *pszFile, L_INT32 uFileAttrib, L_FILETIME ftCreateTime, L_FILETIME ftLastAccessTime, L_FILETIME ftLastWriteTime, L_UINT32 uFileSize); }; L_INT LInetFtp_BrowseDirExample(HWND hWndParent, L_TCHAR *pszDirName) { L_INT nRet; LUserInetFtp UserInetFtp(TEXT("www.leadtools.com")); // Checking if the connection failed nRet = UserInetFtp.GetErrorFromList (); if(nRet != SUCCESS) { UserInetFtp.DisplayError (hWndParent, TEXT("Can't connect to the FTP server")); return nRet; } nRet = UserInetFtp.BrowseDir(pszDirName); if(nRet != SUCCESS) { UserInetFtp.DisplayError(hWndParent, TEXT("Can't browse the remote directory")); return nRet; } return SUCCESS; } LUserInetFtp::LUserInetFtp(L_TCHAR *pszServer, L_TCHAR *pszUserName, L_TCHAR *pszPassword, L_INT nPort) { UNREFERENCED_PARAMETER(pszServer); UNREFERENCED_PARAMETER(pszUserName); UNREFERENCED_PARAMETER(pszPassword); UNREFERENCED_PARAMETER(nPort); } L_INT LUserInetFtp::BrowseCallBack(L_TCHAR *pszFile, L_INT32 uFileAttrib, L_FILETIME ftCreateTime, L_FILETIME ftLastAccessTime, L_FILETIME ftLastWriteTime, L_UINT32 uFileSize) { UNREFERENCED_PARAMETER(uFileAttrib); UNREFERENCED_PARAMETER(ftCreateTime); UNREFERENCED_PARAMETER(ftLastAccessTime); UNREFERENCED_PARAMETER(ftLastWriteTime); UNREFERENCED_PARAMETER(uFileSize); MessageBox(NULL, pszFile, TEXT("FTP Browsing"), MB_OK); return SUCCESS; }