Share via


CWnd::DoDataExchange

virtualvoidDoDataExchange(CDataExchange*pDX);

Parameters

pDX

A pointer to a CDataExchange object.

Remarks

Called by the framework to exchange and validate dialog data.

Never call this function directly. It is called by the UpdateData member function. Call UpdateData to initialize a dialog box’s controls or retrieve data from a dialog box.

When you derive an application-specific dialog class from CDialog, you need to override this member function if you wish to utilize the framework’s automatic data exchange and validation. ClassWizard will write an overridden version of this member function for you containing the desired “data map” of dialog data exchange (DDX) and validation (DDV) global function calls.

To automatically generate an overridden version of this member function, first create a dialog resource with the dialog editor, then derive an application-specific dialog class. Then call ClassWizard and use it to associate variables, data, and validation ranges with various controls in the new dialog box. ClassWizard then writes the overridden DoDataExchange, which contains a data map. The following is an example DDX/DDV code block generated by ClassWizard:

void CPenWidthsDlg::DoDataExchange(CDataExchange* pDX)
{
   CDialog::DoDataExchange(pDX);
   //{{AFX_DATA_MAP(CPenWidthsDlg)

      DDX_Text(pDX, IDC_THIN_PEN_WIDTH, m_nThinWidth);

      DDV_MinMaxInt(pDX, m_nThinWidth, 1, 20);

      DDX_Text(pDX, IDC_THICK_PEN_WIDTH, m_nThickWidth);

      DDV_MinMaxInt(pDX, m_nThickWidth, 1, 20);
   //}}AFX_DATA_MAP
}

ClassWizard will maintain the code within the \\{{ and \\}} delimiters. You should not modify this code.

The DoDataExchange overridden member function must precede the macro statements in your source file.

For more information on dialog data exchange and validation, see in the article ODBC and MFC, , and in the Visual C++ Programmer's Guide. For a description of the DDX_ and DDV_ macros generated by ClassWizard, see Technical Note 26.

CWnd OverviewClass MembersHierarchy Chart

See Also   CWnd::UpdateData