| |
| DWORD FindFile( |
| |
LPCTSTR lpszFileName, |
|
| |
DWORD dwQueueMode, |
|
| |
DWORD dwExcludeFiles |
|
| ); |
The FindFile method finds a file in the transfer
queue which matches the search criteria.
Parameters
- lpszFileName
- A null-terminated string which specifies the name
of the file to search for. The string may contain the wildcard
character '?' to match against any single character, and '*' will
match any number of characters. This parameter cannot be NULL or
point to an empty string.
- 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. This is a bitmask which may be one or more of
the following values:
| Constant |
Description |
| HTTP_QUEUE_ALL |
Match the file name to all files in the queue. |
| HTTP_QUEUE_DOWNLOAD |
Match file names which are queued for download. |
| HTTP_QUEUE_UPLOAD |
Match file names which are queued for upload. |
| HTTP_QUEUE_LOCAL |
Match against the local file name instead of the remote file
name. |
- 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 from the search. |
| 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. |
Return Value
If the method succeeds, the return value is a unique identifier
for the file. To obtain information about the file, call the
GetFile method. If the method fails, the return value is
zero. To get extended error information, call GetLastError.
Remarks
This method returns a unique file identifier for the first file
which matches the specified file name in the queue. If the
lpszFileName parameter includes wildcard characters, this
method will return the first file in the queue which matches the
name. File name matches are not case-sensitive, even when matching
against remote file names on servers which use case-sensitive naming,
such as UNIX based servers.
To perform more complex searches based on the file name, or to find
multiple files, you can use the GetFirstFile
and GetNextFile methods to iterate through
all queued files.
Example
DWORD dwFileId = pQueue->FindFile(lpszFileName,
HTTP_QUEUE_DOWNLOAD | HTTP_QUEUE_LOCAL,
HTTP_QUEUE_FLAG_NONE);
if (dwFileId != 0)
{
HTTPQUEUEDFILE queuedFile;
if (pQueue->GetFile(dwFileId, &queuedFile))
{
switch (queuedFile.dwMode)
{
case HTTP_QUEUE_DOWNLOAD:
_tprintf(_T("%u: Download \"%s\" to \"%s\"\n"),
dwFileId,
queuedFile.szRemoteFile,
queuedFile.szLocalFile);
break;
case HTTP_QUEUE_UPLOAD:
_tprintf(_T("%u: Upload \"%s\" to \"%s\"\n"),
dwFileId,
queuedFile.szLocalFile,
queuedFile.szRemoteFile);
break;
}
}
}
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
|
|