When you use controls such as Edit Control of MFC, you may encounter the following problem: Error: "ddx_control ":
Parameter 3 cannot be converted from "int" to "cwnd &" or error: "ddx_control": parameter 3 cannot be converted from "cstring" to "cwnd &". why?
I. Analysis
After checking the materials and searching, I also saw some specific analyses:
In a dialog boxProgramThere is a button idc_button_ OK. CTRL + W (vc6.0) or Ctrl + Shift + X to enter the Class View. On the member variables page, double-click idc_button_ OK in the list and a dialog box is displayed, this box in the middle usually lists two types:
One is the data type such as cstring and INT, and the other is the control type cbutton.
The former data type is the title content of the control, and the latter is an object bound to the control. Ddx_contral is the latter type, _ control is the control type, and _ text is the data type. Modify as follows: (the DDX _ function is a data exchange function)
Ddx_control (PDX, idc_button1, m_botton1 );
Ddx_text (PDX, idc_button1, m_botton1); (or delete this statement)
Ii. Deep Analysis
What is the cause of this error?
I foundAdd the control variable int cstring in the Class Wizard(CTRL + shitf + x)
Select value firstType, rather than control to force the variable type to be int type, and then select int and cstring type in the variable type. In the custom variable name. This forced conversion will cause a specific error.
As shown in, add an edit control Control (edit box) Control and define the control as a cstring type. The variable name is m_edit5. The control and value types are available in the control and value fields. Select value.
At the same time, it seems that in the button control, I tried to select value. It seems that there is only a control category, because some controls are very special, such as buttons, which can only be defined as the button type, and specific analysis of the control.
Hope the aboveArticleIt can help you, but you can skip this step. At the same time, I also referred to the following blog's content tips!
(-By: eastmout)