Click to return to the Networking, Protocols     
FTP Functions     FtpCreateDirectory Functi...     FTP Functions    
Web Workshop  |  Networking, Protocols & Data Formats

FtpCommand Function


Allows an application to send 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
);

The actual syntax of this function varies between its ANSI and Unicode implementations. For more information, see Win32 Internet Functions Syntax.

Parameters

hConnect
HINTERNET handle returned from a call to InternetConnect.
fExpectResponse
Boolean value that indicates whether or not the application expects a response from the FTP server. This must be set to TRUE if a response is expected, or FALSE otherwise.
dwFlags
Unsigned long integer value that contains the flags that control this function. This can be set to one of the following values:
FTP_TRANSFER_TYPE_ASCII
Transfers the file using FTP's ASCII (Type A) transfer method. Control and formatting information is converted to local equivalents.
FTP_TRANSFER_TYPE_BINARY
Transfers the file using FTP's Image (Type I) transfer method. The file is transferred exactly as it exists with no changes. This is the default transfer method.
lpszCommand
Address of a string value that contains the command to send to the FTP server.
dwContext
Address of an unsigned long integer value that contains an application-defined value that is used to identify the application context in callbacks.
phFtpCommand
Address of an HINTERNET handle that will be 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.

Function Information

Windows NT Use version 4.0. Implemented as ANSI and Unicode functions.
Windows Use Windows 95 and later. Implemented as ANSI and Unicode functions.
Header Wininet.h
Import Library Wininet.lib
Minimum availability Internet Explorer 5

Windows CE

Windows CE Use version 2.12 and later. Implemented as ANSI and Unicode functions.
Minimum availability Internet Explorer 4.0

See Also

Microsoft Win32 Internet Functions Overview, FTP Sessions, Microsoft Win32 Internet Functions Reference, FTP Functions



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.