好心人来帮忙-练习MSDN中的TNO62示例程序解决方法
好心人来帮忙------练习MSDN中的TNO62示例程序
好心人给讲讲这七个错误的原因,解决方法,需要那些参考资料
--------------------Configuration: TNO62 - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
TNO62.cpp
1: error C2146: syntax error : missing '; ' before identifier 'm_YellowEdit '
2: error C2501: 'CYelloEdit ' : missing storage-class or type specifiers
3: error C2501: 'm_YellowEdit ' : missing storage-class or type specifiers
TNO62Dlg.cpp
4: error C2146: syntax error : missing '; ' before identifier 'm_YellowEdit '
5: error C2501: 'CYelloEdit ' : missing storage-class or type specifiers
6: error C2501: 'm_YellowEdit ' : missing storage-class or type specifiers
7: error C2065: 'm_YellowEdit ' : undeclared identifier
YelloEdit.cpp
Generating Code...
Error executing cl.exe.
TNO62.exe - 7 error(s), 0 warning(s)
前六个错误都指向这里:
//{{AFX_DATA(CTNO62Dlg)
enum { IDD = IDD_TNO62_DIALOG };
CYelloEdit m_YellowEdit;
//}}AFX_DATA
这个m_YellowEdit,我按照MSDN的要求定义为(Control)CYellowEdit类型,这个CYellowEdit从CEdit继承
最后一个错误指向这里:
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTNO62Dlg)
DDX_Control(pDX, IDC_EDIT1, m_YellowEdit);
//}}AFX_DATA_MAP
}
按照MSDN的要求,先在Dialog Box上画一个edit,然后设置其变量为Control 并且为CYellowEdit类型
令问: ON_WM_CTLCOLOR_REFLECT() 干吗的?
附MSDN的示例
To try the example that creates a reusable control
Create a new dialog box in an existing application. For more information, see the dialog editor topic.
You must have an application in which to develop the reusable control. If you don 't have an existing application to use, create a dialog-based application using AppWizard.
With your project loaded into Visual C++, use ClassWizard to create a new class called CYellowEdit based on CEdit.
Add three member variables to your CYellowEdit class. The first two will be COLORREF variables to hold the text color and the background color. The third will be a CBrush object that will hold the brush for painting the background. The CBrush object allows you to create the brush once, merely referencing it after that, and to destroy the brush automatically when the CYellowEdit control is destroyed.
好心人给讲讲这七个错误的原因,解决方法,需要那些参考资料
--------------------Configuration: TNO62 - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
TNO62.cpp
1: error C2146: syntax error : missing '; ' before identifier 'm_YellowEdit '
2: error C2501: 'CYelloEdit ' : missing storage-class or type specifiers
3: error C2501: 'm_YellowEdit ' : missing storage-class or type specifiers
TNO62Dlg.cpp
4: error C2146: syntax error : missing '; ' before identifier 'm_YellowEdit '
5: error C2501: 'CYelloEdit ' : missing storage-class or type specifiers
6: error C2501: 'm_YellowEdit ' : missing storage-class or type specifiers
7: error C2065: 'm_YellowEdit ' : undeclared identifier
YelloEdit.cpp
Generating Code...
Error executing cl.exe.
TNO62.exe - 7 error(s), 0 warning(s)
前六个错误都指向这里:
//{{AFX_DATA(CTNO62Dlg)
enum { IDD = IDD_TNO62_DIALOG };
CYelloEdit m_YellowEdit;
//}}AFX_DATA
这个m_YellowEdit,我按照MSDN的要求定义为(Control)CYellowEdit类型,这个CYellowEdit从CEdit继承
最后一个错误指向这里:
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTNO62Dlg)
DDX_Control(pDX, IDC_EDIT1, m_YellowEdit);
//}}AFX_DATA_MAP
}
按照MSDN的要求,先在Dialog Box上画一个edit,然后设置其变量为Control 并且为CYellowEdit类型
令问: ON_WM_CTLCOLOR_REFLECT() 干吗的?
附MSDN的示例
To try the example that creates a reusable control
Create a new dialog box in an existing application. For more information, see the dialog editor topic.
You must have an application in which to develop the reusable control. If you don 't have an existing application to use, create a dialog-based application using AppWizard.
With your project loaded into Visual C++, use ClassWizard to create a new class called CYellowEdit based on CEdit.
Add three member variables to your CYellowEdit class. The first two will be COLORREF variables to hold the text color and the background color. The third will be a CBrush object that will hold the brush for painting the background. The CBrush object allows you to create the brush once, merely referencing it after that, and to destroy the brush automatically when the CYellowEdit control is destroyed.