工程是用win32建立的,想在里面调用MFC的类函数,如CBitmapButton。该如何做?已经做了修改:Project-Setting-General-Use MFC in a Share DLLStdAfx.h 包含了如下语句:
#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions#if defined(_WIN32_WCE) && (_WIN32_WCE >= 211) && (_AFXDLL)
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#endif#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT程序编译没问题,但是启动的时候会报错
why?

解决方案 »

  1.   

    直接修改stdafx.h头文件
    添加#define    VC_EXTRALEAN   
    #include   <afxwin.h>      
    #include   <afxext.h>  
    #include   <afxdisp.h>    
    #include   <afxdtctl.h>   
    #ifndef    _AFX_NO_AFXCMN_SUPPORT     
    #include   <afxcmn.h>        
    #endif   
    要是启动出错,可以设置个断点,调试看看什么地方出错~~~
      

  2.   

    对了,要删除#include <windows.h>
    因为#include    <afxwin.h>已经包含了~~~
      

  3.   

    MFC很多类,涉及到资源的,需要一个当前资源句柄,要么自己生成一个CWinApp的对象,要么用AfxSetResourceHandle设置一下试试。
      

  4.   

    自己定义一个CWinApp类的全局变量。