atl和mfc
2011-08-22 19:48
148 查看
In a way, ATL is to COM what MFC is to the Windows API. The goal of ATL is to provide a thin but effective wrapper around the most common COM interfaces without sacrificing component performance. Despite this similarity, however, the designs of MFC and ATL differ in several key ways:
MFC contains an interconnected hierarchy of classes, whereas ATL is a set of disjoint templates. This difference means that with ATL you don't pay the size/speed penalty for a given feature unless your component actually uses it.
MFC is linked to a project as a static library or a DLL, but ATL is compiled as source code. Because there are no OBJ files to link to, ATL requires no run-time DLL redistribution.1
MFC supports a single-inheritance model, whereas the functionality of an ATL component depends entirely on the use of multiple inheritance. Specifically, a component that supports several different COM interfaces will inherit from several different associated ATL templates.
Over time, MFC has grown considerably. As the expectations placed on Windows applications have increased, so have the size and feature set of MFC. Although a similar progression is likely as the use of ATL becomes more prevalent, ATL's use of templates rather than regular inheritance will almost assuredly prevent class proliferation.
简而言之, ATL开发更灵活,而MFC开发更快速
Unfortunately, MFC support for OLE and COM doesn't follow the same model as its support for the Windows API. Although MFC's window classes contain a substantial number of inline wrappers (à la CWnd::SendMessage), its OLE classes aren't nearly as lightweight. As a result, MFC is less suited for middle-tier COM object development than it is for Windows development or even OLE development. Until recently, the COM limitations of MFC have been largely forgivable—ActiveX controls developed with MFC are perfectly adequate for use in end-user applications written in Visual Basic and MFC. And when it comes to traditional OLE support—OLE document servers, compound documents, containers, and so on—MFC is the best choice. However, the recent trend toward client/server Internet applications and the three-tier architecture described earlier has exposed two problems. First, even the smallest components created using MFC are generally considered too large for use within a Web browser, especially considering the time it takes to download the associated DLLs. Second, MFC is not well suited for creating server components that provide no user interface but must simultaneously support multiple threads of execution. Thus, whereas MFC still has something to offer future Windows applications, it falls short when it comes to developing COM objects in the business services tier.
MFC contains an interconnected hierarchy of classes, whereas ATL is a set of disjoint templates. This difference means that with ATL you don't pay the size/speed penalty for a given feature unless your component actually uses it.
MFC is linked to a project as a static library or a DLL, but ATL is compiled as source code. Because there are no OBJ files to link to, ATL requires no run-time DLL redistribution.1
MFC supports a single-inheritance model, whereas the functionality of an ATL component depends entirely on the use of multiple inheritance. Specifically, a component that supports several different COM interfaces will inherit from several different associated ATL templates.
Over time, MFC has grown considerably. As the expectations placed on Windows applications have increased, so have the size and feature set of MFC. Although a similar progression is likely as the use of ATL becomes more prevalent, ATL's use of templates rather than regular inheritance will almost assuredly prevent class proliferation.
简而言之, ATL开发更灵活,而MFC开发更快速
Unfortunately, MFC support for OLE and COM doesn't follow the same model as its support for the Windows API. Although MFC's window classes contain a substantial number of inline wrappers (à la CWnd::SendMessage), its OLE classes aren't nearly as lightweight. As a result, MFC is less suited for middle-tier COM object development than it is for Windows development or even OLE development. Until recently, the COM limitations of MFC have been largely forgivable—ActiveX controls developed with MFC are perfectly adequate for use in end-user applications written in Visual Basic and MFC. And when it comes to traditional OLE support—OLE document servers, compound documents, containers, and so on—MFC is the best choice. However, the recent trend toward client/server Internet applications and the three-tier architecture described earlier has exposed two problems. First, even the smallest components created using MFC are generally considered too large for use within a Web browser, especially considering the time it takes to download the associated DLLs. Second, MFC is not well suited for creating server components that provide no user interface but must simultaneously support multiple threads of execution. Thus, whereas MFC still has something to offer future Windows applications, it falls short when it comes to developing COM objects in the business services tier.
相关文章推荐
- 应该使用哪个框架?用ATL和MFC来创建ActiveX控件3
- ATL和MFC创建ActiveX控件的区别(转)
- ATL、MFC、WTL CString 的今生前世
- MFC程序员的WTL开发指南之ATL界面类
- ATL、MFC、WTL CString 的今生前世
- ATL、MFC、WTL CString 的今生前世
- C++ win32编程、mfc编程、ATL编程的区别
- WTL for MFC Programmers, Part I - ATL GUI Classes
- ATL和MFC的C++类和HWND的映射机制
- WTL for MFC Programmers, Part I - ATL GUI Classes
- 为MFC 和 ATL控件创建签署的CAB文件
- Win32平台各种主流开发框架(MFC、ATL、WTL、VCL等)
- WTL\MFC\ATL CSTRING的前世今生
- ATL与MFC消息分发机制的对比
- 为MFC 和 ATL控件创建签署的CAB文件
- ATL/CLR/MFC/Win32
- 应该使用哪个框架?用ATL和MFC来创建ActiveX控件2
- MFC,STL,COM,ATL中使用了哪些设计模式
- 在MFC和ATL工程中加入GIF动画(CPictureEx,CPitureExWnd)
- COM、MFC、ATL等概念区别