您的位置:首页 > 其它

怎样在SDK程序中使用MFC中的辅助类

2008-10-15 14:05 274 查看
1.加入相应的头文件

由于在SDK程序中一定要包含Windows.h头文件,所以在使用MFC中的类时,如加入afx.h一类的头文件会有一个提示与windows.h相冲突,解决的办法是,去掉windows.h,然后在所有的.h文件前加入#include "stdafx.h"

#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

注意一定要在所有的头文件之前加入这几行,而起顺序最好不要改变,否则会有大量的错误提示。

2.更改编译设置

在Project->Setting->General中选Use MFC in a Shared DLL或者Use MFC in static Library,并把project->Setting->C/C 中的Use runing-time library 由Single-Threaded改为相应的Multithreaded。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: