The FtpCommand function sends commands directly to an FTP server.
Syntax
BOOL FtpCommand(
__in HINTERNET hConnect,
__in BOOL fExpectResponse,
__in DWORD dwFlags,
__in LPCTSTR lpszCommand,
__in DWORD_PTR dwContext,
__out HINTERNET *phFtpCommand
);
Parameters
- hConnect [in]
-
A handle returned from a call to
InternetConnect.
- fExpectResponse [in]
-
A Boolean value that indicates whether the application expects a data connection to be established by the FTP server. This must be set to TRUE if a data connection is expected, or FALSE otherwise.
- dwFlags [in]
-
A parameter that can be set to one of the following values.
| Value | Meaning |
- FTP_TRANSFER_TYPE_ASCII
| Transfers the file using the FTP ASCII (Type A) transfer method. Control and formatting data is converted to local equivalents.
|
- FTP_TRANSFER_TYPE_BINARY
| Transfers the file using the FTP Image (Type I) transfer method. The file is transferred exactly with no changes. This is the default transfer method.
|
- lpszCommand [in]
-
A pointer to a string that contains the command to send to the FTP server.
- dwContext [in]
-
A pointer to a variable that contains an application-defined value used to identify the application context in callback operations.
- phFtpCommand [out]
-
A pointer to a handle that is created if a valid data socket is opened. The
fExpectResponse parameter must be set to TRUE for
phFtpCommand to be filled.
Return Value
Returns TRUE if successful, or FALSE otherwise. To get a specific error message, call
GetLastError.
Remarks
GetLastError can return
ERROR_INTERNET_NO_DIRECT_ACCESS if the client application is offline. If one or more of the parameters are invalid,
GetLastError will return ERROR_INVALID_PARAMETER.
Requirements
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| Version | Internet Explorer 5.0 or later |
| Header | Wininet.h |
| Library | Wininet.lib |
| DLL | Wininet.dll |
| Unicode and ANSI names | FtpCommandW (Unicode) and FtpCommandA (ANSI) |
See Also
- FTP Sessions
- WinINet Functions
Send comments about this topic to Microsoft
Build date: 7/9/2009