Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
ftpcommand (wininet)
 
.
Summary
Sends commands directly to an FTP server.

C# Signature:

[DllImport("wininet.dll", CharSet=CharSet.Ansi, SetLastError=true, ExactSpelling=true)]
public static extern bool FtpCommandA
(IntPtr hFtpSession,
[MarshalAs(UnmanagedType.Bool)] bool fExpectResponse,
int dwFlags,
[MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszCommand,
IntPtr dwContext,
IntPtr phFtpCommand);

VB Signature:

Declare Function FtpCommandA Lib "wininet.dll" _
(ByVal hFtpSession As IntPtr, _
<MarshalAs(UnmanagedType.Bool)> ByVal fExpectResponse As Boolean, _
ByVal dwFlags As Integer, _
ByVal lpszCommand As String, _
ByVal dwContext As IntPtr, _
ByVal phFtpCommand As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

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 Values : Returns TRUE if successful, or FALSE otherwise. To get a specific error message, call GetLastError.

Tips & Tricks:

Please add some!

Sample Code:

Dim ret As Boolean = FTPCommandA(ConnectionHandle, False, 0, sCommand, IntPtr.Zero, IntPtr.Zero)

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions