在Win32应用程序中使用MFC类库
来源:互联网 发布:mac框架 编辑:程序博客网 时间:2024/05/01 08:54
由于MFC中的辅助类,如CFileDialog,CFileFind,CString等使用起来非常的方便如果用API来完成相应的工作,则需要自己完成大量的重复工作,使用MFC的辅助类可以节省大量的开发时间,具体方法如下:
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。
- 在Win32应用程序中使用MFC类库
- 在Win32应用程序中使用MFC类库
- 在Win32应用程序中使用MFC类库
- 在Win32应用程序中使用MFC类库(转)
- 在Win32应用程序中使用MFC类库(转)
- (GDI+) 如何在 MFC 或 Win32 应用程序中使用GDI+
- win32中使用MFC类库
- 如何在win32控制台应用程序中使用C++类库
- 在Win32应用程序中使用combo box
- 在win32 应用程序中使用控制台
- 在win32项目中使用mfc类
- 在WIN32 DLL中使用MFC
- 如何在win32 Application 中使用MFC
- 在Win32中使用MFC库
- 在WIN32 DLL中使用MFC
- 在WIN32 DLL中使用MFC
- 在Win32 应用程序中引用MFC中的部分类
- 在 Win32 Application 和 Win32 Console Application 中使用 MFC
- Java。哎
- JQuery常用方法总结
- 网站优化,只需做好这几点
- 最简单的DDRAW C代码实现(只支持YUV420数据)
- 怎样拯救被百度K掉的站点
- 在Win32应用程序中使用MFC类库
- NoSQL漫谈 (阿里DBA所写)
- 光脚丫学LINQ(028):如何将表表示为类
- [原]VB6的Active DLL调用时,报“运行时错误”(429、430)的错误
- 数据库备份到远程机器
- VC 各种情况下的窗口句柄的获取
- C++学习 -- 构造函数和析构函数
- 类的static函数成员在定义时不用要static
- COM:IUnknown、IClassFactory、IDispatch