Introduction
The systems need to exchange data to communicate between two parts of a software system. This data is represented by the Data Transfer Classes.
These classes are public (or static) classes with no methods.

Let's now briefly discuss Data Transfer Classes with some examples.
Data Transfer Classes
The data transfer class is a static class in the Active Template Library (ATL) that transports the data between the subsystems. The main purpose of these classes is to reduce the amount of overhead created, which in turn will reduce the number of system calls needed between the subsystems.

Let's now discuss some examples of Data transfer classes.
IDataObjectImpl Class
This class supports Uniform Data Transfer (UDP) using standard formats and methods to retrieve and set data. IDataObjectImpl Class manages connections and changes notifications to advise sinks.
Syntax
template<class T>
class IDataObjectImpl
Here, T is your class, derived from IDataObjectImpl.
Public Methods
| Name | Description | Syntax |
| IDataObjectImpl::DAdvise | By using this method, a link is created between the advice sink and the data object. This makes it possible for the advice sink to be notified of changes to the object. |
HRESULT DAdvise( FORMATETC* pformatetc, DWORD advf, IAdviseSink* pAdvSink, DWORD* pdwConnection);
|
| IDataObjectImpl::DUnadvise | Terminates a connection that was previously established using DAdvise. | HRESULT DUnadvise(DWORD dwConnection); |
| IDataObjectImpl::EnumDAdvise | Builds an enumerator that may be used to loop through the current advisory connections. |
HRESULT DAdvise( FORMATETC* pformatetc, DWORD advf, IAdviseSink* pAdvSink, DWORD* pdwConnection); |
| IDataObjectImpl::EnumFormatEtc | Creates an enumerator that can loop through all the FORMATETC structures that the data object supports. Returns E_NOTIMPL from the ATL implementation. |
HRESULT EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatEtc);
|
| IDataObjectImpl::FireDataChange | It sends a change notification to every advice sink. | HRESULT FireDataChange(); |
| IDataObjectImpl::GetDataHere | Similar to GetData, with the exception that the client must allocate the STGMEDIUM structure. E NOTIMPL is the result of the ATL implementation. |
HRESULT GetDataHere( FORMATETC* pformatetc, STGMEDIUM* pmedium);
|
| IDataObjectImpl::QueryGetData | Determines whether the data object is compatible with a specific FORMATETC data transfer structure. The ATL implementation returns the E_NOTIMPL. | HRESULT QueryGetData(FORMATETC* pformatetc); |
| IDataObjectImpl::SetData |
Transfer data to the data object from the client. E NOTIMPL is the result of the ATL implementation.
|
HRESULT SetData( FORMATETC* pformatetc, STGMEDIUM* pmedium, BOOL fRelease);
|
| IDataObjectImpl::GetData | Transfers data to the client from the data object. The data is sent over a STGMEDIUM structure after being described in a FORMATETC structure. |
HRESULT GetData( FORMATETC* pformatetcIn, STGMEDIUM* pmedium);
|
CBindStatusCallback Class
This class carries out IBindStatusCallback interface implementation. It enables an asynchronous moniker to communicate with your object and transmit and receive information about asynchronous data transfers.
Syntax
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>
Here,
T is your class containing the function that will be invoked as the data is received.
nBindFlags
Specifies the bind flags that GetBindInfo returns. The default implementation sets the binding asynchronous, retrieves the most recent version of the data/object, and does not keep the data it retrieves in the disc cache.
Members
Public Constructors
| Name | Description | Syntax |
| CBindStatusCallback::CBindStatusCallback | It is the constructor that creates an object to receive notifications related to the asynchronous data transfer. For every bind operation, typically, one object is created. | CBindStatusCallback(); |
| CBindStatusCallback::~CBindStatusCallback | The destructor that frees all allocated resources. | ~CBindStatusCallback(); |
Public Methods
| Name | Description | Syntax |
| CBindStatusCallback::Download | The static method that starts the downloading process creates a CBindStatusCallback object and calls StartAsyncDownload. |
HRESULT DAdvise( FORMATETC* pformatetc, DWORD advf, IAdviseSink* pAdvSink, DWORD* pdwConnection);
|
| CBindStatusCallback::GetBindInfo | Requested by the asynchronous moniker to obtain details regarding the kind of bind that will be formed. | HRESULT DUnadvise(DWORD dwConnection); |
| CBindStatusCallback::GetPriority | Called by the asynchronous moniker to obtain the binding operation's priority. E_NOTIMPL is the result of the ATL implementation. |
HRESULT DAdvise( FORMATETC* pformatetc, DWORD advf, IAdviseSink* pAdvSink, DWORD* pdwConnection); |
| 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. |
HRESULT EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatEtc);
|
| CBindStatusCallback::OnLowResource | Called when resources are low. The ATL implementation returns S_OK. | HRESULT FireDataChange(); |
| CBindStatusCallback::OnObjectAvailable | Called by the asynchronous moniker to pass an object interface pointer to your application. The ATL implementation returns S_OK. |
HRESULT GetDataHere( FORMATETC* pformatetc, STGMEDIUM* pmedium);
|
| CBindStatusCallback::OnProgress | Called to indicate the progress of a data downloading process. The ATL implementation returns S_OK. | HRESULT QueryGetData(FORMATETC* pformatetc); |
| CBindStatusCallback::OnStartBinding | Called when the binding is started. |
HRESULT SetData( FORMATETC* pformatetc, STGMEDIUM* pmedium, BOOL fRelease);
|
| CBindStatusCallback::OnStopBinding | Called when the asynchronous data transfer is stopped. |
HRESULT GetData( FORMATETC* pformatetcIn, STGMEDIUM* pmedium);
|
Public Data Members
| CBindStatusCallback::m_dwAvailableToRead | Number of bytes available to read. | DWORD m_dwAvailableToRead; |
| CBindStatusCallback::m_dwTotalRead | Total number of bytes read. | DWORD m_dwTotalRead; |
| CBindStatusCallback::m_pFunc | Pointer to the function called when data is available. | ATL_PDATAAVAILABLE m_pFunc; |
| CBindStatusCallback::m_pT | Pointer to the object requesting the asynchronous data transfer. | T* m_pT; |




