Share via


CBindStatusCallback Class

This class implements the IBindStatusCallback interface.

Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

template <class T, int nBindFlags= BINDF_ASYNCHRONOUS |  
BINDF_ASYNCSTORAGE | BINDF_GETNEWESTVERSION | BINDF_NOWRITECACHE> 
class ATL_NO_VTABLE CBindStatusCallback : public CComObjectRootEx 
<T::_ThreadModel::ThreadModelNoCS>, public IBindStatusCallbackImpl<T> 

Parameters

  • T
    Your class containing the function that will be called as the data is received.

  • nBindFlags
    Specifies the bind flags that are returned by GetBindInfo. The default implementation sets the binding to be asynchronous, retrieves the newest version of the data/object, and does not store retrieved data in the disk cache.

Members

Public Constructors

Name

Description

CBindStatusCallback::CBindStatusCallback

The constructor.

CBindStatusCallback::~CBindStatusCallback

The destructor.

Public Methods

Name

Description

CBindStatusCallback::Download

Static method that starts the download process, creates a CBindStatusCallback object, and calls StartAsyncDownload.

CBindStatusCallback::GetBindInfo

Called by the asynchronous moniker to request information on the type of bind to be created.

CBindStatusCallback::GetPriority

Called by the asynchronous moniker to get the priority of the bind operation. The ATL implementation returns E_NOTIMPL.

CBindStatusCallback::OnDataAvailable

Called to provide data to your application as it becomes available. Reads the data, then calls the function passed to it to use the data.

CBindStatusCallback::OnLowResource

Called when resources are low. The ATL implementation returns S_OK.

CBindStatusCallback::OnObjectAvailable

Called by the asynchronous moniker to pass an object interface pointer to your application. The ATL implementation returns S_OK.

CBindStatusCallback::OnProgress

Called to indicate the progress of a data downloading process. The ATL implementation returns S_OK.

CBindStatusCallback::OnStartBinding

Called when binding is started.

CBindStatusCallback::OnStopBinding

Called when the asynchronous data transfer is stopped.

CBindStatusCallback::StartAsyncDownload

Initializes the bytes available and bytes read to zero, creates a push-type stream object from a URL, and calls OnDataAvailable every time data is available.

Public Data Members

Name

Description

CBindStatusCallback::m_dwAvailableToRead

Number of bytes available to read.

CBindStatusCallback::m_dwTotalRead

Total number of bytes read.

CBindStatusCallback::m_pFunc

Pointer to the function called when data is available.

CBindStatusCallback::m_pT

Pointer to the object requesting the asynchronous data transfer.

CBindStatusCallback::m_spBindCtx

Pointer to the IBindCtx interface for the current bind operation.

CBindStatusCallback::m_spBinding

Pointer to the IBinding interface for the current bind operation.

CBindStatusCallback::m_spMoniker

Pointer to the IMoniker interface for the URL to use.

CBindStatusCallback::m_spStream

Pointer to the IStream interface for the data transfer.

Remarks

The CBindStatusCallback class implements the IBindStatusCallback interface. IBindStatusCallback must be implemented by your application so it can receive notifications from an asynchronous data transfer. The asynchronous moniker provided by the system uses IBindStatusCallback methods to send and receive information about the asynchronous data transfer to and from your object.

Typically, the CBindStatusCallback object is associated with a specific bind operation. For example, in the ASYNC sample, when you set the URL property, it creates a CBindStatusCallback object in the call to Download:

STDMETHOD(put_URL)(BSTR newVal)
{
   HRESULT hResult = E_UNEXPECTED;

   ATLTRACE(_T("IATLAsync::put_URL\n"));
   m_bstrURL = newVal;

   if (::IsWindow(m_EditCtrl.m_hWnd))
   {
      ::SendMessage(m_EditCtrl.m_hWnd, WM_SETTEXT, 0,  (LPARAM)_T(""));
      hResult = CBindStatusCallback<CATLAsync>::Download(this, &CATLAsync::OnData, 
         m_bstrURL, m_spClientSite, FALSE);
   }

   return hResult;
}

The asynchronous moniker uses the callback function OnData to call your application when it has data. The asynchronous moniker is provided by the system.

Inheritance Hierarchy

CComObjectRootBase

IBindStatusCallback

CComObjectRootEx

CBindStatusCallback

Requirements

Header: atlctl.h

See Also

Other Resources

ATL Class Overview