CHttpQueue::GetFirstFile Method  
 
DWORD GetFirstFile(
  DWORD dwQueueMode,  
  DWORD dwExcludeFiles,  
  LPHTTPQUEUEDFILE lpFileInfo  
);

The HttpGetFirstFile method returns information about the first file in the transfer queue.

Parameters

dwQueueMode
An unsigned integer value which specifies if the file name should be matched against downloaded files, uploaded files or all files in the queue. It may be one of the following values:
Constant Description
HTTP_QUEUE_ALL Return information about all files in the queue.
HTTP_QUEUE_DOWNLOAD Return information for files which are queued for download.
HTTP_QUEUE_UPLOAD Return information for files which are queued for upload.
dwExcludeFiles
An unsigned integer value which specifies which files to exclude from the search. If this value is zero, no files will be excluded from the search; otherwise, this value is constructed by using a bitwise operator with any of the following values:
Value Description
HTTP_QUEUE_FLAG_NONE No files should be excluded.
HTTP_QUEUE_FLAG_COMPLETED Exclude files which have been transferred. This flag is set after a queued file has been uploaded or downloaded successfully.
HTTP_QUEUE_FLAG_FAILED Exclude files which where not successfully uploaded or downloaded. This flag is set when an error occurs, either when establishing a connection with the server or during the file transfer.
HTTP_QUEUE_FLAG_CANCELED Exclude files which were canceled during the file transfer. This flag is only set when the Cancel method has been called and a queued file is in the process of being uploaded or downloaded.
lpFileInfo
A pointer to a HTTPQUEUEDFILE structure which will contain information about the file. This parameter cannot be NULL.

Return Value

If the method succeeds, the return value is an unsigned integer with a non-zero value which uniquely identifies the file in the queue. If there are no queued files which match the specified parameters, or the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

This method returns information about the first file in the current transfer queue. It is used in conjunction with the GetNextFile method to obtain information about all queued files.

Example

// List all files in a file transfer queue
HTTPQUEUEDFILE queuedFile;
DWORD dwFileId;

dwFileId = pQueue->GetFirstFile(HTTP_QUEUE_ALL, HTTP_QUEUE_FLAG_NONE, &queuedFile);

while (dwFileId != 0)
{
    switch (queuedFile.dwQueueMode)
    {
    case HTTP_QUEUE_DOWNLOAD:
        _tprintf(_T("%u: download \"%s\" to \"%s\"\n"),
                 queuedFile.dwFileId,
                 queuedFile.szRemoteFile,
                 queuedFile.szLocalFile);
        break;

    case HTTP_QUEUE_UPLOAD:
        _tprintf(_T("%u: upload \"%s\" to \"%s\"\n"),
                 queuedFile.dwFileId,
                 queuedFile.szRemoteFile,
                 queuedFile.szLocalFile);
        break;
    }

    dwFileId = pQueue->GetNextFile(&queuedFile);
}

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: cshtpv12.lib
Unicode: Implemented as Unicode and ANSI versions

See Also