编译出现这些错误:
1.
void CTmp2Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
CButton * b;
b=new CButton [5];
b[1]-> Create( "b1 ",WS_CHILD,CRect(20,20,100,100),this,100);
b[1]-> ShowWindow(SW_SHOW);
}
编译出现这些错误:
--------------------Configuration: tmp2 - Win32 Debug--------------------
Compiling...
tmp2Dlg.cpp
D:\myVC\tmp2\tmp2Dlg.cpp(218) : error C2819: type 'CButton ' does not have an overloaded member 'operator -> '
d:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(2704) : see declaration of 'CButton '
D:\myVC\tmp2\tmp2Dlg.cpp(218) : error C2227: left of '-> Create ' must point to class/struct/union
D:\myVC\tmp2\tmp2Dlg.cpp(219) : error C2819: type 'CButton ' does not have an overloaded member 'operator -> '
d:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(2704) : see declaration of 'CButton '
D:\myVC\tmp2\tmp2Dlg.cpp(219) : error C2227: left of '-> ShowWindow ' must point to class/struct/union
Error executing cl.exe.
tmp2.exe - 4 error(s), 0 warning(s)
[解决办法]
CButton *b;
b=new CButton[5];
b[1].Create( "b1 ",WS_CHILD,CRect(20,20,100,100),this,100);
b[1].ShowWindow(SW_SHOW);