<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
由于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
MFC辅助类在SDK程序中的应用
本文介绍如何在SDK程序中利用MFC提供的辅助类,如CFileDialog等,以减少开发工作量并提高效率。文章详细说明了必要的头文件引入及编译设置调整步骤。
1万+

被折叠的 条评论
为什么被折叠?



