共用方式為


CDataExchange::PrepareCtrl

The framework calls this member function to prepare the specified control for dialog data exchange (DDX) and validation (DDV).

HWND PrepareCtrl(
   int nIDC 
);

Parameters

  • nIDC
    The ID of the control to be prepared for DDX or DDV.

Return Value

The HWND of the control being prepared for DDX or DDV.

Remarks

Use PrepareEditCtrl instead for edit controls; use this member function for all other controls.

Preparation consists of storing the control's HWND in the CDataExchange class. The framework uses this handle to restore the focus to the previously focused control in the event of a DDX or DDV failure.

Implementors of custom DDX or DDV routines should call PrepareCtrl for all non-edit controls for which they are exchanging data via DDX or validating data via DDV.

For more information on writing your own DDX and DDV routines, see Technical Note 26. For an overview of DDX and DDV, see Dialog Data Exchange and Validation and Dialog Box Topics.

Requirements

Header: afxwin.h

See Also

Concepts

CDataExchange Class

CDataExchange Members

Hierarchy Chart

CDataExchange::Fail