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

MFC辅助类在SDK程序中的应用
本文介绍如何在SDK程序中利用MFC提供的辅助类,如CFileDialog等,以减少开发工作量并提高效率。文章详细说明了必要的头文件引入及编译设置调整步骤。
<clk>在SDK<nobr onmousemove="kwM(1);" onmouseout="kwL(event, this);" onmouseover="kwE(event,1, this);" oncontextmenu="return false;" target="_1" onclick="return kwC(event,1)" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" id="clickeyekey1">程序</nobr>中使用MFC中的辅助类 </clk>
由于MFC中的辅助类,如CFileDialog,CFileFind,CString等使用起来非常的方便
如果用API来完成相应的工作,则需要自己完成大量的重复工作,使用MFC的辅助类
<clk>可以节省大量的<nobr onmousemove="kwM(2);" onmouseout="kwL(event, this);" onmouseover="kwE(event,2, this);" oncontextmenu="return false;" target="_1" onclick="return kwC(event,2)" style="border-bottom: 1px dotted rgb(102, 0, 255); text-decoration: underline; color: rgb(102, 0, 255); background-color: transparent;" id="clickeyekey2">开发</nobr>时间,具体方法如下: </clk>

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
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值