#include <afxwin.h>
#include "resource.h"
class yyy:public CFrameWnd
{
public :
CMenu *m;
yyy()
{
m=new CMenu;
Create(0,"Hell0");
m->LoadMenu(IDR_MENU1);
SetMenu(m);
}};class zzz:public CWinApp
{
public :
zzz()
{
yyy *a;
a=new yyy;
m_pMainWnd=a;
a->ShowWindow(SW_SHOWMAXIMIZED);
}
};zzz a;
#include "resource.h"
class yyy:public CFrameWnd
{
public :
CMenu *m;
yyy()
{
m=new CMenu;
Create(0,"Hell0");
m->LoadMenu(IDR_MENU1);
SetMenu(m);
}};class zzz:public CWinApp
{
public :
zzz()
{
yyy *a;
a=new yyy;
m_pMainWnd=a;
a->ShowWindow(SW_SHOWMAXIMIZED);
}
};zzz a;
m.Create(0,"Hell0");
error C2228: left of '.Create' must have class/struct/union type
Error executing cl.exe.
D:\C-PPT-V1.0\TP\xx\f.cpp(10) : error C2039: 'Create' : is not a member of 'CMenu'
c:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(1080) : see declaration of 'CMenu'
D:\C-PPT-V1.0\TP\xx\f.cpp(11) : error C2819: type 'CMenu' does not have an overloaded member 'operator ->'
c:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(1080) : see declaration of 'CMenu'
D:\C-PPT-V1.0\TP\xx\f.cpp(11) : error C2227: left of '->LoadMenuA' must point to class/struct/union
D:\C-PPT-V1.0\TP\xx\f.cpp(12) : error C2664: 'SetMenu' : cannot convert parameter 1 from 'class CMenu' to 'class CMenu *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.xx.exe - 5 error(s), 0 warning(s)
也不行
是错的m=new CMenu;
m->Create(0,"Hell0");