在SDK程式中使用MFC中的輔助類 (轉)

worldblog發表於2007-12-07
在SDK程式中使用MFC中的輔助類 (轉)[@more@]

 

在SDK中使用MFC中的輔助類
由於MFC中的輔助類,如CFileDialog,CFileFind,CString等使用起來非常的方便
如果用來完成相應的工作,則需要自己完成大量的重複工作,使用MFC的輔助類
可以節省大量的開發時間,具體方法如下:

1.加入相應的頭

由於在SDK程式中一定要包含.h標頭檔案,所以在使用MFC中的類時,
如加入afx.h一類的標頭檔案會有一個提示與windows.h相沖突,解決的辦法是,
去掉windows.h,然後在所有的.h檔案前加入

#include "stdafx.h"
#include   // MFC core and standard components
#include   // MFC extensions
#include   // MFC Automation classes
#include   // MFC support for Inte Explorer 4 Common Controls

#include

注意一定要在所有的標頭檔案之前加入這幾行,而且順序最好不要改變,否則會有大量的錯誤提示

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
 


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-989222/,如需轉載,請註明出處,否則將追究法律責任。

相關文章