Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function queries the amount of data available.

Syntax

BOOL WINAPI InternetQueryDataAvailable(
  HINTERNET 
hFile, 
  LPDWORD 
lpdwNumberOfBytesAvailable, 
  DWORD 
dwFlags, 
  DWORD 
dwContext
);

Parameters

hFile

[in] Valid Internet file handle, as returned by InternetOpenUrl, FtpOpenFile, FtpFindFirstFileand HttpOpenRequest

lpdwNumberOfBytesAvailable

[out] Optional. Long pointer to a variable that receives the number of available bytes.

dwFlags

[in] Reserved. Must be set to zero.

dwContext

[in] Reserved. Must be set to zero.

Return Value

TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. If the function finds no matching files, GetLastErrorreturns ERROR_NO_MORE_FILES.

Remarks

The InternetQueryDataAvailablefunction can be completed in either synchronous or asynchronous mode.

InternetQueryDataAvailablereturns the number of bytes of data that are available to be read immediately by a subsequent call to InternetReadFile. If there is currently no data available and the end of the file has not been reached, the request waits until data becomes available. The amount of data remaining will not be recalculated until all available data indicated by the call to InternetQueryDataAvailableis read.

For HINTERNET handles created by HttpOpenRequestand sent by HttpSendRequestEx, a call to HttpEndRequestmust be made on the handle before InternetQueryDataAvailablecan be used.

Requirements

Header wininet.h
Library wininet.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also