CWnd::OnCopyData

This member function is called by the framework to copy data from one application to another.

afx_msg BOOL OnCopyData(
   CWnd* pWnd,
   COPYDATASTRUCT* pCopyDataStruct 
);

Parameters

  • pWnd
    A pointer to a CWnd object that is sending the data.

  • pCopyDataStruct
    A pointer to a COPYDATASTRUCT structure that contains the data being sent.

Return Value

Returns TRUE if the receiving application successfully accepts the data. Otherwise, returns FALSE.

Remarks

The data being passed must not contain pointers or other references to objects not accessible to the application receiving the data.

While the data is being copied, it must not be changed by another thread of the sending process.

The receiving application should consider the data read-only. The structure pointed to by the parameter pCopyDataStruct is valid only during the transfer of data; however, the receiving application should not free the memory associated with the structure.

If the receiving application needs access to the data after this function returns, it must copy the data received to a local buffer.

Note

This member function is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function.

Requirements

Header: afxwin.h

See Also

Reference

CWnd Class

Hierarchy Chart

WM_COPYDATA

Concepts

CWnd Members