I am learning MFC Dialog Applications and as the first try I did the tutorial explained here
I am using visual Studio 2010 but when I run this I get errors as
error C2664: 'DDX_Control' : cannot convert parameter 3 from 'CString' to 'CWnd &' 1>\\documents\\visual studio 2010\\projects\\mfc\\mfc\\mfcdlg.cpp(75): error C2065: 'IDC_BUTTON1' : undeclared identifier 1>\\documents\\visual studio 2010\\projects\\mfc\\mfc\\mfcdlg.cpp(75): error C2065: 'IDC_BUTTON1' : undeclared identifier 1>\\documents\\visual studio 2010\\projects\\mfc\\mfc\\mfcdlg.cpp(76): error C2065: 'IDC_COMBO1' : undeclared identifier 1>\\documents\\visual studio 2010\\projects\\mfc\\mfc\\mfcdlg.cpp(76): error C2065: 'IDC_COMBO1' : undeclared identifier 1>
I did exactly as mentioned in the note.
void CMFCDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Text(pDX, IDC_FIRSTNAME, m_strFirstName);
DDX_Text(pDX, IDC_LASTNAME, m_strLastName);
DDX_Control(pDX, IDC_TITLE, m_strTiltle);
DDX_LBString(pDX, IDC_NAMELIST, m_strFullName);
DDX_Control(pDX, IDC_NAMELIST, m_NameList);
}
As this is my first time doing anything in MFC applications I have no idea what went wrong.Can someone please help me to understand what is wrong?
I am not very sure you followed the steps in the tutorial correctly, you should not get these errors if you had...
C2664 Error: change DDX_Control(pDX, IDC_TITLE, m_strTiltle);
to DDX_Text(pDX, IDC_TITLE, m_strTiltle);
C2065 errors: The tutorial does not contain IDC_BUTTON1
/ IDC_COMBO1
, it mentions a IDC_ADD
button and a IDC_TITLE
combo box.
m_strTitle
is a value of type CString
, in your code m_strTitle
is define as a control. For the rest, you maybe have rename or delete identifiers, use appropriate.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.