The control of the dialog box is associated with the object of the corresponding class :(Two methods)
(1) associate data using the cwnd: dodataexchange function;
Use the Add variable on the member variables page in the MFC classwizard of VC ++ 6.0 to associate a variable.
ThenDodataexchangeThe function containsDdx_xxxxxFunction association. This method is very common. For example, a cedit control can be associated with either a cedit object or a variable of the Int or cstring type;
(2) associate with a function (associate with the object of the corresponding class)
The main applications are as follows:
Cwnd * getdlgitem (int Nid ) Const;
NidIs the resource ID. Of course, the control must be a control derived from cwnd;
1. For example, a progress bar Control
Cprogressctrl * g_ptrprogress1 = NULL;
G_ptrprogress1 =(Cprogressctrl *)Getdlgitem (idc_progress1 );
// Pay attention to forced conversion.Cwnd *Forced conversionCprogressctrl *
2. For example, an editing box
Cedit * pboxone;
Pboxone = (cedit *) getdlgitem (idc_edit1 );