MFC Edit Control Error: "ddx_control": parameter 3 cannot be converted from "int" to "cwnd &"

Source: Internet
Author: User

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)

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.