Microsoft Visual C++ 6.0 各类工程配置说明(一)

本文详细介绍了使用MFC(Microsoft Foundation Classes)库进行不同类型的Windows应用程序开发时的配置方法,包括预编译头文件的设置、编译参数及连接参数等,并对比了使用静态库与动态链接库的不同。

1.    基于 对话 框( / 文档 / 多文档)的 MFC 程序

#include <afxdtctl.h>     // MFC support for Internet Explorer 4 Common

#include <afxwin.h>      // MFC core and standard components

#include <afxext.h>      // MFC extensions

#include <afxdisp.h>     // MFC Automation classes

#define VC_EXTRALEAN     // Exclude rarely-used stuff from Windows headers

stdafx.h 预编译头 文件

afxext.h 声明MFC 一些 (CBitmapButton 、CControlBar 、CSplitterWnd 等)

afxdisp.h 中声明了Ole 的几个 (COleException 、COleVariant 等)

afxwin.h 声明MFC 封装的一些很基本的 (CWnd 、CView 、CButton 、CDC 等)afxdtctl.h 声明几个控件 (CImageList 、CMonthCalCtrl 、CDateTimeCtrl 等)Controls

afxcmn.h 声明MFC 一些控件(CListCtrl 、CProgressCtrl 、CToolTipCtrl 等)

#include <afxcmn.h>     // MFC support for Windows Common Controls

#ifndef _AFX_NO_AFXCMN_SUPPORT
#endif // _AFX_NO_AFXCMN_SUPPORT

(1.1)Use MFC in a Shared DLL
Debug
版本:
:WIN32,_DEBUG,_WINDOWS,_AFXDLL,_MBCS
编译 参数:/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR"Debug/" /Fp"Debug/ExeDlg.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ      /c
接参数:/nologo /subsystem:windows /incremental:yes /pdb:"Debug/ExeDlg.pdb" /debug /machine:I386 /out:"Debug/ExeDlg.exe" /pdbtype:sept
Release 版本:
:与Debug 版本相比,将_DEBUG 替 成了NDEBUG
编译 参数:/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"Release/ExeDlg.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c
接参数:/nologo /subsystem:windows /incremental:no /pdb:"Release/ExeDlg.pdb" /machine:I386 /out:"Release/ExeDlg.exe"
(1.2)Use MFC in a Static Library
Debug 版本:
:与(1.1) 相比,少了_AFXDLL
编译 参数:将/MDd (使用Run-time library: Debug Multithreaded DLL ) 成了/MTd (使用Run-time library: Debug Multithreaded )
接参数:与(1.1) 相同
Release 版本:
编译 参数/MD (使用Run-time library: Multithreaded DLL ) 成了MT (使用Run-time library: Multithreaded )
***
注:以上 编译 / 接参数含 如下(更多的, 参考Msdn ):
/nologo :抑制信息在
编译 或者 在Output Window 出;      /MD :运行 时库 使用MSVCRT.DLL ;      /W3 : 编译时显 Warning 级别为 3 ;      /Gm :Enable Minimal Rebuild ,一 减少重 编译 选项 ;     /GX :Enable Exception Handling ;        /ZI : 置Debug 信息保存的数据 文件.PDB 中;       /Od :Disable 代 码优 化;        /FR :生成.SBR 文件,包含有符号信息;          /Fp :命名生成的 预编译头 文件;        /Yu :指定 预编译头 文件。
2.MFC DLL

预编译头 文件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
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxole.h>            // MFC OLE classes
#include <afxodlgs.h>          // MFC OLE dialog classes
#include <afxdisp.h>           // MFC Automation classes
#endif // _AFX_NO_OLE_SUPPORT
#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h>               // MFC ODBC database classes
#endif // _AFX_NO_DB_SUPPORT
#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h>             // MFC DAO database classes
#endif // _AFX_NO_DAO_SUPPORT
#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
增加了两个OLE 的
文件和两个数据 文件
(2.1) Use MFC in a Shared DLL
Debug 版本:
:WIN32,_DEBUG,_WINDOWS,_WINDLL,_AFXDLL,_MBCS,_USRDLL ,与MFC Exe 程序相比,增加了_WINDLL 和_USRDLL
编译 参数:与MFC Exe 没有太大区
接参数:/nologo /subsystem:windows /dll /incremental:yes /pdb:"Debug/MFCDll.pdb" /debug /machine:I386 /def:"./MFCDll.def" /out:"Debug/MFCDll.dll" /implib:"Debug/MFCDll.lib" /pdbtype:sept
与MFC Exe 相比,增加了/dll 定
,以及/def:"./MFCDll.def" 和/implib:"Debug/MFCDll.lib" 。 注意:其中 MFCDll 测试 目名字,非 DLL 名字。从 目的文件上看, 目比 MFC Exe 生一个 .def 的文件用于定 义导 出函数。 Release 版本与Debug 版本的区 别类 目1 中的比 (上了_AFXDLL 定 )。
(2.2) Use MFC in a Static DLL
与(2.1) 的区
,主要在使用的Run-time library 型上,与 目1 中的比
3.MFC Extension DLL

预编译头 文件stdafx.h 内容与 目2 相同。
(3.1) Use MFC in a Shared DLL
Debug 版本:
:WIN32,_DEBUG,_WINDOWS,_MBCS,_AFXEXT,_WINDLL,_AFXDLL ,与 目2 相比,将_USRDLL 成了_AFXEXT 。
编译 参数:与上述 目没有太大区
接参数:与 MFC DLL 目相似
Release
版本与 Debug 版本的区 别类 1 中的比 (上了 _AFXDLL )。
(3.2) Use MFC in a Static DLL
似以上 目的比
( 注:以下
目均以Debug 版本 述。)
4.Win32 DLL

预编译头 文件stdafx.h:
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers                   #include <windows.h>
现项 目入口函数DllMain 的 实现
(4.1) Not Using MFC
:WIN32,_DEBUG,_WINDOWS,_MBCS,_USRDLL,WIN32DLLDEMO_EXPORTS ,与 目2(MFC DLL) 相比,少了_WINDLL,_AFXDLL ,而 保留了_USRDLL 。另外,WIN32DLLDEMO_EXPORTS 自定 出宏。
编译 参数:没有太大区
接参数:kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"Debug/Win32DllDemo.pdb" /debug /machine:I386 /out:"Debug/Win32DllDemo.dll" /implib:"Debug/Win32DllDemo.lib" /pdbtype:sept
与MFC DLL
目相比,多了很多 接,少了/subsystem:windows 的定

MFC类目录及头文件 类 描述 头文件 CAnimateCtrl 自动化通用控件 afxcmn.h CArchive afx.h CArchiveException afx.h CArray afxtempl.h CAsyncMonikerFile 在ActiveX控件中提供对异步标记的支持 afxole.h CAsyncScoket 封装Windows Sockets API,参看CSocket afxsock.h CBitmap afxwin.h CBitmapButton afxext.h CBrush afxwin.h CButton 按钮控件对象 afxwin.h CByteArray afxcoll.h CCachedDataPathProperty 允许个ActiveX控件异步传输属性数据和缓冲内存中的数据,参考CDataPathProperty afxctl.h CCheckListBox afxwin.h CClientDC afxwin.h CCmdTarget 所有能够接收和响应消息的对象的基类 afxwin.h CCmdUI afxwin.h CColorDialog 颜色选择的通用对话框,提供为显示系统定义的颜色列表 afxdlgs.h CComboBox 组合框对象 afxwin.h CComboBoxEx CComboBox类的派生类,用于支持在组合框控件中的图像列表 afxcmn.h CCommandLineInfo afxwin.h CCommonDialog afxdlgs.h CConnectionPoint afxdisp.h CControlBar afxext.h CCreateContext afxext.h CCriticalSection afxmt.h CCtrlView afxwin.h CDaoDatabase afxdao.h CDaoException afxdao.h CDaoFieldExchange afxdao.h CDaoQueryDef afxdao.h CDaoRecordset 代表选自数据源的记录集。CDaoRecordset对象可用于三种格式:表类型记录集,动态集类型记录集和快照类型记录集 afxdao.h CDaoRecordView 提供表单视图,以在控件中显示数据库记录。表单视图是CDaoRecordset对象的部分。参考CFormView和CRecordView afxdao.h CDaoTableDef afxdao.h CDaoWorkspace afxdao.h CDatabase afxdb.h CDataExchange afxwin.h CDataPathProperty 实现个ActiveX控件属性,它能够异步加载其数据。这个类允许ActiveX控件在后台下载属性数据时被激活 afxctl.h CDateTimeCtrl 封装新的日期/时间选取器控件 afxdtctl.h CDBException afxdb.h CDBVariant afxdb.h CDC afxwin.h CDialog 用于包含控件窗口的对话框对象 afxwin.h CDialogBar afxext.h CDocItem afxole.h CDockState afxadv.h CDocObjectServer afxdocob.h CDocObjectServerItem afxdocob.h CDocTemplate afxwin.h CDocument 用于管理程序的数据的类 afxwin.h CDragListBox Windows列表框,允许用户把其中的项拖放到不同的位置 afxcmn.h CDumpContext afx.h CDWordArray afxcoll.h CEdit 用于文本输入的子窗口控件 afxwin.h CEditView 提供Windows编缉控件的功能。因为CEditView派生于Cedit,该对象可同文件和文件模板同使用 afxext.h CEvent afxmt.h CException afx.h CFieldExchange afxdb.h CFile afx.h CFileDialog 通用文件对话框,提供Open和Save As对话框中的功能 afxdlgs.h CFileException afx.h CFileFind afx.h CFindReplaceDialog afxdlgs.h CFont afxwin.h CFontDialog 通用字体对话框,用于显示当前已装入系统的字体列表 afxdlgs.h CFontHolder afxctl.h CFormView 包含对话框控件的窗口 afxext.h CFrameWnd SDI(单窗口界面)框架窗口 afxwin.h CFtpConnection afxinet.h CFtpFileFind afxinet.h CGdiObject afxwin.h CGopherConnection afxinet.h CGopherFile afxinet.h CGopherFileFind afxinet.h CGopherLocator afxinet.h CHeaderCtrl 标题通用控件 afxcmn.h CHotKeyCtrl 热键通用控件 afxcmn.h CHtmlStream afxisapi.h CHtmlView 实现Web Browser控件的视图类,能够访问当地或Web上的HTML文件。 afxhtml.h CHttpConnection afxinet.h CHttpFile afxinet.h CHttpFilter 创建并处理超文传输协议过滤器对象,该对象用于过滤用于HTTP请求的服务器通知 afxisapi.h CHttpFilterContext afxisapi.h CHttpServer Internet Server API(ISAPI)的包装类 afxisapi.h CHttpServerContext afxisapi.h CImageList afxcmn.h CInternetConnection afxinet.h CInternetException afxinet.h CInternetFile afxinet.h CInternetSession afxinet.h CIPAddressCtrl IP地址控件。类似于编缉框,该控件接收Internet 协议格式的地址 afxcmn.h CList afxtempl.h CListBox 列表框对象 afxwin.h CListCtrl 列表视通用控件 afxcmn.h ClistView 简化CListCtrl的使用,添加了对文件和视图的支持 afxcview.h CLongBinary afxdb_.h CMap afxtempl.h CMapPtrToPtr afxcoll.h CMapPtrToWord afxcoll.h CMapStringToOb afxcoll.h CMapStringToPtr afxcoll.h CMapStringToString afxcoll.h CMapWordToOb afxcoll.h CMapWordToPtr afxcoll.h CMDIChildWnd MDI(多文档界面)子框架窗口 afxwin.h CMDIFrameWnd afxwin.h CMemFile afx.h CMemoryException afx.h CMemoryState CMenu afxwin.h CMetaFileDC afxext.h CMiniFrameWnd 半高的框架窗口,主要用于浮动工具栏。个小框架窗口没有最小化和最大化按钮,但其他都类似于正常的框架窗口 afxwin.h CMonikerFile afxole.h CMonthCalCtrl 月历控件,用于显示个用户可选择日期的日历 afxdtctl.h CMultiDocTemplate afxwin.h CMultiLock afxmt.h CMutex afxmt.h CNotSupportedException afx.h CObArray afxcoll.h CObject afx.h CObList afxcoll.h COleBusyDialog afxodlgs.h COleChangeIconDialog afxodlgs.h COleChangeSourceDialog afxodlgs.h COleClientItem afxole.h COleCmdUI afxdocob.h COleControl afxctl.h COleControlModule afxctl.h COleConvertDialog afxodlgs.h COleCurrency afxdisp.h COleDataObject afxole.h COleDataSource afxole.h COleDateTime afxdisp.h COleDateTimeSpan afxdisp.h COleDBRecordView afxoledb.h COleDialog afxodlgs.h COleDispatchDriver afxdisp.h COleDispatchException afxdisp.h COleDocObjectItem afxole.h COleDocument 把个文件看作为CDocItem对象的个集合。包容器和服务器都需要这个结构,因为它们的文件必须能够包含OLE项 afxole.h COleDropSource afxole.h COleDropTarget afxole.h COleException afxdisp.h COleInsertDialog afxodlgs.h COleIPFrameWnd afxole.h COleLinkingDoc OLE包容器文件的基类,这些文件支持对它们所包含项的链接 afxole.h COleLinksDialog afxodlgs.h COleMessageFilter afxole.h COleObjectFactory afxdisp.h COlePasteSpecialDialog afxodlgs.h COlePropertiesDialog afxodlgs.h COlePropertyPage afxctl.h COleResizeBar afxole.h COleSafeArray afxdisp.h COleServerDoc OLE服务器文件的基类 afxole.h COleServerItem 为OLE项提供个服务器界面 afxole.h COleStreamFile afxole.h COleTemplateServer afxdisp.h COleUpdateDialog afxodlgs.h COleVariant afxdisp.h CPageSetupDialog afxdlgs.h CPaintDC afxwin.h CPalette afxwin.h CPen afxwin.h CPictureHolder afxctl.h CPoint atltypes.h CPrintDialog 通用打印对话框,提供Print和Print Setup对话框中的功能 afxdlgs.h CPrintInfo CProgressCtrl 通用进程指示器控件 afxcmn.h CPropertyPage 代表属性表单中的页 afxdlgs.h CPropertyPageEx CPropertySheet 属性表,也叫做多选项卡对话框。个属性表由个CPropertySheet对象和几个CPropertyPage对象组成 afxdlgs.h CPropertySheetEx CPropExchange afxctl.h CPtrArray afxcoll.h CPtrList afxcoll.h CReBar afxext.h CReBarCtrl afxcmn.h CRecentFileList afxadv.h CRecordset 用于访问数据库表或查询的类 afxdb.h CRecordView 包含对话框控件的窗口 afxdb.h CRect atltypes.h CRectTracker afxext.h CResourceException afxwin.h CRgn afxwin.h CRichEditCntrItem afxrich.h CRichEditCtrl 用户能够输入和编缉文本的窗口,提供字符和程序段格式,以及对嵌入OLE项的支持 afxcmn.h CRichEditDoc afxrich.h CRichEditView afxrich.h CRuntimeClass CScrollBar 滚动条对象 afxwin.h CScrollView 可滚动的窗口,派生于CView afxwin.h CSemaphore afxmt.h CSharedFile afxadv.h CSingleDocTemplate afxwin.h CSingleLock afxmt.h CSize atltypes.h CSliderCtrl 提供包含个滑块和可选的刻度线的窗口 afxcmn.h CSocket Windows Socket API的包装类 afxsock.h CSocketFile afxsock.h CSpinButtonCtrl 提供箭头按钮,用户可单击它,以增加或减少某个控件中的个值 afxcmn.h CSplitterWnd afxext.h CStatic 用于标识另个控件或给用户提供消息的简单文本框 afxwin.h CStatusBar afxext.h CStatusBarCtrl 提供个层次窗口,通常放于父窗口的底部,用于显示关于应用程序的状态信息 afxcmn.h CStdioFile afx.h CString afx.h CStringArray afxcoll.h CStringList afxcoll.h CSyncObject afxmt.h CTabCtrl 允许应用程序在个窗口或对话框的同区域显示多个页面 afxcmn.h CTime afx.h CTimeSpan afx.h CToolBar afxext.h CToolBarCtrl 工具栏通用控件 afxcmn.h CToolTipCtrl 提供工具提示控件的功能,它以个小弹出窗口的样子显示,包含描述某个工具用途的行文本 afxcmn.h CTreeCtrl 显示项的分层结构列表 afxcmn.h CTreeView 简化CTreeCtrl的用法 afxcview.h CTypedPtrArray afxtempl.h CTypedPtrList afxtempl.h CTypedPtrMap afxtempl.h CUIntArray afxcoll.h CUserException afxwin.h CView 用于显示程序数据的类 afxwin.h CWaitCursor afxwin.h CWinApp afxwin.h CWindowDC afxwin.h CWinThread 代表个应用程序中的个线程 afxwin.h CWnd afxwin.h CWordArray afxcoll.h ......
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值