CHttpQueue::Wait Method  
 
BOOL WINAPI HttpWaitForQueue(
  DWORD dwMilliseconds,  
  LPDWORD lpdwElapsed,  
  LPDWORD lpdwError  
);
BOOL WINAPI HttpWaitForQueue(
  DWORD dwMilliseconds  
);

The Wait method waits for the specified queue to complete the file transfers.

Parameters

dwMilliseconds
An unsigned integer value which specifies the number of milliseconds to wait for the queue to complete processing. If this value is zero, the method will return immediately. If this value is INFINITE (0xFFFFFFFF), the method will block indefinitely until all files in the queue have been processed.
lpdwElapsed
A pointer to an unsigned integer which will contain the number of milliseconds the queue manager has been active when the method returns. If this information is not needed, this parameter can omitted or it can be NULL. If this parameter is not NULL, it will always be initialized to a value of zero.
lpdwError
A pointer to an unsigned integer which will contain the last error code set if a file transfer has failed or was canceled. If this information is not needed, this parameter can be omitted or NULL. If this parameter is not NULL, it will always be initialized to a value of zero.

Return Value

If the method succeeds, the return value is non-zero, which means the queue manager has completed transferring all queued files. If the method fails, or the timeout period elapses, it will return zero. To get extended error information, call GetLastError.

Remarks

This method will cause the current thread to block until either the queue manager has completed processing all files in the queue, or until the specified number of milliseconds have elapsed. It is important to note that Windows messages will not be processed during this time. If you call this method within the main UI thread, it can potentially cause the application to become non-responsive. To determine the current state of the queue without blocking the current thread, call the GetStatus method.

If the dwMilliseconds parameter is non-zero and file transfers have not completed within the specified amount of time, the method will return zero and the last error code will be set to ST_ERROR_OPERATION_TIMEOUT.

If an event callback function has been specified when starting the queue, you should never call this method within the event handler. Attempting to do so can potentially create a situation which will cause the application to become non-responsive. The method will return zero if it determines it's being called within the context of the queue manager thread and will set the last error code to ST_ERROR_THREAD_DEADLOCK.

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

See Also