IBindStatusCallback::OnDataAvailable method

Provides data to the client as it becomes available during asynchronous bind operations.


HRESULT OnDataAvailable(
  [in] DWORD     grfBSCF,
  [in] DWORD     dwSize,
  [in] FORMATETC *pformatetc,
  [in] STGMEDIUM *pstgmed


  • grfBSCF [in]
    An unsigned long integer value from the BSCF enumeration that indicates the kind of data available.

  • dwSize [in]
    An unsigned long integer value that contains the size, in bytes, of the total data available from the current bind operation.

  • pformatetc [in]
    The address of the FORMATETC structure that indicates the format of the available data. This parameter is used when the bind operation results from the IMoniker::BindToStorage method. If there is no format associated with the available data, pformatetc might contain CF_NULL. Each different call to IBindStatusCallback::OnDataAvailable can pass in a new value for this parameter; every call always points to the same data.

  • pstgmed [in]
    The address of the STGMEDIUM structure that contains pointers to the interfaces (such as IStream and IStorage) that can be used to access the data. In the asynchronous case, client applications might receive a second pointer to the IStream or IStorage interface from the IMoniker::BindToStorage method. The client application must call Release on the interfaces to avoid memory leaks.

Return value

Returns S_OK if successful, or E_INVALIDARG if one or more parameters are invalid.


During asynchronous IMoniker::BindToStorage bind operations, an asynchronous moniker calls this method to provide data to the client as it becomes available.

Note that the behavior of the storage returned in pstgmed depends on the BINDF flags returned in the IBindStatusCallback::GetBindInfo method. This storage can be asynchronous or blocking, and the bind operation can follow a data pull model or a data push model. For BINDF bind operations, it is not possible to seek backward into data streams that are provided in IBindStatusCallback::OnDataAvailable. On the other hand, for data push model bind operations, it is possible to seek back into a data stream, and to read any data that has been downloaded for an ongoing IMoniker::BindToStorage operation.


Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003


Internet Explorer 4.0



See also