CFtpQueue::Cancel Method  
 
BOOL Cancel(
  DWORD dwFileId  
);

The Cancel method cancels the specified file transfer.

Parameters

dwFileId
An optional unsigned integer value which uniquely identifies the file in the queue. If this parameter is omitted or the value is zero, the method will cancel the current file transfer in progress. If queue transfers have been suspended, this parameter cannot be zero.

Return Value

If the method succeeds, the return value is non-zero. If the method fails, it will return zero. To get extended error information, call GetLastError.

Remarks

When this method is called, the queued file transfer may not immediately stop. An internal flag is set which causes the file transfer to exit with an error and the queue manager will begin processing the next file in the queue. If the queue is in an idle state, this method will fail.

It is permitted to call the Cancel method from within a queue event handler to cancel the current file transfer. In this case, the dwFileId parameter should be zero. If you specify a file which has not been transferred, it will be flagged as canceled and skipped by the queue manager when processing the queue. If you specify a file which has already been processed, this method will fail.

A canceled file transfer is also considered a failed transfer. When you call GetStatus after a queued file transfer is canceled, the dwFailedFiles member of the FTPQUEUESTATUS structure will be incremented to reflect this change. You can determine the status of an individual file transfer by calling the GetFile method and checking the value of the dwQueueFlags member of the FTPQUEUEDFILE structure.

The Reset method can be used to reset the state of previously canceled transfers.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csftpv12.lib

See Also