首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

关于深入浅出代码有关问题

2012-03-20 
关于深入浅出代码问题深入浅出MFC代码frame3的MFC.H中自己输入进VC6后老是出问题IMPLEMENT_DYNAMIC(CCmdTa

关于深入浅出代码问题
深入浅出MFC代码
frame   3的MFC.H中  
自己输入进VC6后老是出问题

IMPLEMENT_DYNAMIC(CCmdTarget,CObject)//提示这里出问题
IMPLEMENT_DYNAMIC(CWinThread,CCmdTarget)
IMPLEMENT_DYNAMIC(CWinApp,CWinThread)
IMPLEMENT_DYNAMIC(CWnd,CCmdTarget)
IMPLEMENT_DYNAMIC(CFrameWnd,CWnd)
IMPLEMENT_DYNAMIC(CDocument,CCmdTarget)
IMPLEMENT_DYNAMIC(CView,CWnd)


C:\Documents   and   Settings\catface\桌面\mfc   teach\defframe3\MFC.CPP(51)   :   error   C2065:   'lpszCCmdTarget '   :   undeclared   identifier
C:\Documents   and   Settings\catface\桌面\mfc   teach\defframe3\MFC.CPP(51)   :   error   C2440:   'initializing '   :   cannot   convert   from   'int '   to   'char   * '
                Conversion   from   integral   type   to   pointer   type   requires   reinterpret_cast,   C-style   cast   or   function-style   cast
C:\Documents   and   Settings\catface\桌面\mfc   teach\defframe3\MFC.CPP(51)   :   error   C2440:   'initializing '   :   cannot   convert   from   'unsigned   int '   to   'char   * '
                Conversion   from   integral   type   to   pointer   type   requires   reinterpret_cast,   C-style   cast   or   function-style   cast
C:\Documents   and   Settings\catface\桌面\mfc   teach\defframe3\MFC.CPP(51)   :   error   C2440:   'initializing '   :   cannot   convert   from   'const   int '   to   'char   * '
                Conversion   from   integral   type   to   pointer   type   requires   reinterpret_cast,   C-style   cast   or   function-style   cast
C:\Documents   and   Settings\catface\桌面\mfc   teach\defframe3\MFC.CPP(51)   :   error   C2440:   'initializing '   :   cannot   convert   from   'struct   CRuntimeClass   * '   to   'int '


[解决办法]
#define _IMPLEMENT_RUNTIMECLASS(class_name,base_class_name,wSchema,pfnNew)\
static char _lpsz##class_name[]=#class_name;\
CRuntimeClass class_name::class##class_name={\
lpsz##class_name,sizeof(class_name),wSchema,pfnNew,\
^^^^^^^_lpsz##class_name

RUNTIME_CLASS(base_class_name),NULL};\
static AFX_CLASSINIT _init_##class_name(&class_name::class##class_name);\
CRuntimeClass* class_name::GetRuntimeClass() const \
{return &class_name::class##class_name;}\

热点排行