在SDK程序中使用MFC中的辅助类
2008-04-01 18:35
169 查看
在SDK程序中使用MFC中的辅助类
由于MFC中的辅助类,如CFileDialog,CFileFind,CString等使用起来非常的方便
如果用API来完成相应的工作,则需要自己完成大量的重复工作,使用MFC的辅助类
可以节省大量的开发时间,具体方法如下:
1.加入相应的头文件
由于在SDK程序中一定要包含windows.h头文件,所以在使用MFC中的类时,
如加入afx.h一类的头文件会有一个提示与windows.h相冲突,解决的办法是,
去掉windows.h,然后在所有的.h文件前加入
#include "stdafx.h"
#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
#include <afxcmn.h>
注意一定要在所有的头文件之前加入这几行,而起顺序最好不要改变,否则会有大量的错误提示
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
由于MFC中的辅助类,如CFileDialog,CFileFind,CString等使用起来非常的方便
如果用API来完成相应的工作,则需要自己完成大量的重复工作,使用MFC的辅助类
可以节省大量的开发时间,具体方法如下:
1.加入相应的头文件
由于在SDK程序中一定要包含windows.h头文件,所以在使用MFC中的类时,
如加入afx.h一类的头文件会有一个提示与windows.h相冲突,解决的办法是,
去掉windows.h,然后在所有的.h文件前加入
#include "stdafx.h"
#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
#include <afxcmn.h>
注意一定要在所有的头文件之前加入这几行,而起顺序最好不要改变,否则会有大量的错误提示
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 SDI程序中使用SDL
- MFC 使用控制台打印程序信息
- 【转】使用Xcode中的iOS SDK给iphone开发出第一个App程序
- VC程序在非MFC中使用CString
- MFC学习笔记之一——————win32 SDK程序框架逻辑剖析
- 在win32/MFC 程序中使用QT控件。。。。。。。
- 使用hdf5库和MFC写的hdf5文件浏览程序
- MFC小程序003------MFC使用WebBrowser组件,在对话框中创建滚动视图,动态创建一个静态文本控件并设置鼠标单击的消息响应
- VS2010MFC对话框程序中使用Windows Media Player播放音频或视频文件
- VC的Win32控制台程序中使用MFC库文件
- mfc--使用ShellExecute打开另一个可执行程序
- 不使用向导编写简单的MFC程序
- 在使用Ribbon的MFC程序状态栏中显示鼠标坐标值