Contents Previous Page Next Page
IBindStatusCallback::OnDataAvailable

An asynchronous moniker calls this method to provide data to the client as it becomes available during asynchronous bind operations.

HRESULT OnDataAvailable(

    DWORD  
grfBSCF,               //BSCF enumeration values                                               
                                                                                                          
    DWORD  dwSize,                //Length of data in bytes available from current bind operation         
                                                                                                          
    FORMATETC *pfmtetc,           //Pointer to FORMATETC structure                                        
                                                                                                          
    STGMEDIUM *pstgmed            //Pointer to STGMEDIUM structure                                        
                                                                                                          
   );                                                                                                     
                                                                                                          

Parameters

grfBSCF

[in] DWORD value taken from the BSCF enumeration indicating the kind of data available.

dwSize

[in] Size in bytes of total data available from the current bind operation.

pfmtetc

[in] Pointer to the FORMATETC structure that indicates the format of the available data. This parameter is used when the bind operation is a result of IMoniker::BindToStorage. If there is no format associated with the available data, pfmtetc may contain CF_NULL.

pstgmed

[in] Pointer to the STGMEDIUM structure that holds the actual data that is now available. This parameter is used when called as a result of IMoniker::BindToStorage. If the client wishes to keep the data in pstgmed alive, the client should call AddRef on pstgmed->pUnkForRelease (if the pointer is non-NULL) and eventually use the ReleaseStgMedium function to release the storage. Note that pstgmed->pUnkForRelease may be NULL indicating that the storage medium cannot be kept alive. For example, this will be the case when using URL monikers to download data that is not being cached.

Return Values

S_OK

The operation was successful.

E_INVALIDARG

One or more parameters are invalid.

Remarks

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 IBindStatusCallback::GetBindInfo. This storage can be asynchronous or blocking, and the bind operation can follow a data pull model or a data push model.. Furthermore, it is important to note that for BINDF_PULLDATA bind operations, it is not possible to seek backwards into data streams provided in IBindStatusCallback::OnDataAvailable. On the other hand, for data push model bind operations, it is commonly possible to seek back into a data stream and read any data that has been downloaded for an ongoing IMoniker::BindToStorage operation.

See Also

BINDF, BSCF, IBindStatusCallback::GetBindInfo, IBindStatusCallback::OnDataAvailable