FtpCommand function
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.
- 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.
Like all other aspects of the WinINet API, this function cannot be safely called from within DllMain or the constructors and destructors of global objects.
Note WinINet does not support server implementations. In addition, it should not be used from a service. For server implementations or services use Microsoft Windows HTTP Services (WinHTTP).
Requirements
|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server | Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names | FtpCommandW (Unicode) and FtpCommandA (ANSI) |
See also
Send comments about this topic to Microsoft
Build date: 10/26/2012