InternetQueryDataAvailable function (wininet.h)

Queries the server to determine the amount of data available.

Syntax

BOOL InternetQueryDataAvailable(
  [in]  HINTERNET hFile,
  [out] LPDWORD   lpdwNumberOfBytesAvailable,
  [in]  DWORD     dwFlags,
  [in]  DWORD_PTR dwContext
);

Parameters

[in] hFile

Handle returned by the InternetOpenUrl, FtpOpenFile, GopherOpenFile, or HttpOpenRequest function.

[out] lpdwNumberOfBytesAvailable

Pointer to a variable that receives the number of available bytes. May be NULL.

[in] dwFlags

This parameter is reserved and must be 0.

[in] dwContext

This parameter is reserved and must be 0.

Return value

Returns TRUE if the function succeeds, or FALSE otherwise. To get extended error information, call GetLastError. If the function finds no matching files, GetLastError returns ERROR_NO_MORE_FILES.

Remarks

This function returns 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 InternetQueryDataAvailable is read.

For HINTERNET handles created by HttpOpenRequest and sent by HttpSendRequestEx, a call to HttpEndRequest must be made on the handle before InternetQueryDataAvailable can be used.

Like all other aspects of the WinINet API, this function cannot be safely called from within DllMain or the constructors and destructors of global objects.

Note  WinINet does not support server implementations. In addition, it should not be used from a service. For server implementations or services use Microsoft Windows HTTP Services (WinHTTP).
 

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wininet.h
Library Wininet.lib
DLL Wininet.dll

See also

Common Functions

WinINet Functions