怎样在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。
由于在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。
相关文章推荐
- 怎样在SDK程序中使用MFC中的辅助类
- 在SDK程序中使用MFC中的辅助类程序设计
- 在SDK程序中使用MFC中的辅助类
- 在SDK程序中使用MFC中的辅助类
- 在SDK程序中使用MFC中的辅助类
- 在SDK程序中使用MFC中的辅助类
- 在SDK程序中使用MFC中的辅助类库
- 怎样使用MFC单文档程序编写一个鼠标画线程序
- 怎样使用MFC 调用windows系统程序 windows media player
- 抛弃cygwin,使用Android SDK+NDK编译Cocos2d-x安卓程序
- 在MFC SDI程序中使用SDL
- 【VC编程】笔记2--SDK编程的模板程序/MFC消息映射机制的本质解析
- 怎样使用android sdk帮助文档
- VS使用有感——MFC程序移植至其他PC上出现的错误
- MFC程序使用ado,在win7系统上生成的程序,在xp系统上,打开数据库失败
- 怎样让MFC程序重新启动自己
- 使用eclipse+Struts Studio 怎样进行程序调试
- 使用MFC编写internet查询程序
- 非mfc程序使用CString类
- 程序中怎样限制使用时间