|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
Wininet.dll and the corresponding Wininet.lib do not include the FTP APIs. To develop FTP applications on a version of the Windows CE OS that does not export FTP APIs from the Wininet.dll, you can use Winsock. FTP APIs are included in the emulation library, Wininetm.lib, and will work in the emulation environment. You can use the FTP APIs with Windows CE version 2.12 which is included in Wininet.dll and Wininet.lib.
The following illustration shows the FTP functions dependent on the FTP session HINTERNETreturned by InternetConnect. The shaded boxes represent functions that return HINTERNETs and the plain boxes represent functions that use the HINTERNETcreated by the function on which they depend.
The FtpCreateDirectory, FtpDeleteFile, FtpGetCurrentDirectory, FtpGetFile, FtpPutFile, FtpRemoveDirectory, FtpRenameFile, and FtpSetCurrentDirectoryfunctions use the HINTERNEThandle created by InternetConnect.
The following illustration shows the two FTP functions that return HINTERNEThandles and the functions dependent on the HINTERNEThandles created by them. The shaded boxes represent functions that return HINTERNEThandles, while the plain boxes represent functions that use the HINTERNEThandle created by the function on which they depend.
InternetFindNextFileis dependent on the HINTERNEThandle created by FtpFindFirstFile, and InternetReadFileuses the HINTERNEThandle created by FtpOpenFile.
Use WinInet to perform the following tasks on an FTP server:
To access an FTP server with WinInet
InternetOpencreates the root HINTERNEThandle that is used to establish the FTP session. The HINTERNETInternet handle is used by all subsequent functions.
When calling InternetConnectspecify INTERNET_DEFAULT_FTP_PORT for the nServerPortparameter and INTERNET_SERVICE_FTP for the dwServiceparameter.
This function uses the handle returned by InternetOpento create a specific FTP session. InternetConnectinitializes an FTP session for the specified site, using the arguments passed to it and creates HINTERNETthat is a branch off the root handle. In the case of an FTP session, InternetConnectattempts to establish a connection to the specified site.
InternetConnectreturns a handle that subsequent functions can use, such as FtpGetFileor FtpFindFirstFile.
Use the InternetFindNextFilefunction with FtpFindFirstFileto find the next file in a file search, using the search parameters and HINTERNEThandle from FtpFindFirstFile.
To complete a file search, continue to call InternetFindNextFileusing the HINTERNEThandle returned by FtpFindFirstFileuntil function fails with the extended error message ERROR_NO_MORE_FILES. To get the extended error data, call the GetLastErrorfunction.
Note Applications must specify a directory relative to the current directory or include the full directory path.
Last updated on Friday, April 02, 2004