Three types of MFC DLL

2010-04-15  来源:本站原创  分类:CPP  人气:236 

Remember reading, in order not to forget, mark look. .

a, Non-MFC DLL: refers to the structure without MFC class library, written in direct language with C DLL, the output of the function is generally a standard C interface, and can be written in non-MFC or MFC application that calls .

b, Regular (General) DLL: and the following Extension Dlls, as is written in MFC class library. Obvious feature is the source file a class that inherits CWinApp. It can be divided into static and dynamic connection to connect to the MFC to MFC's.

Static link to MFC in the dynamic link library are only VC Professional Edition and Enterprise Edition are supported. The application of such DLL inside the output function can be used any Win32 process, including the use of MFC applications. Input function has the following form:
extern "C" EXPORT YourExportedFunction ();
If there is no extern "C" modification, the output function can only call C + + code.
DLL application derived from CWinApp, but no message loop.

Dynamic link to MFC DLL application of rules inside the output function can be any Win32 program uses, including the use of MFC applications. However, all output from the DLL function should begin with the following statement:
AFX_MANAGE_STATE (AfxGetStaticModuleState ())
This statement is used to switch the MFC module state correctly.

Regular DLL can be all supported DLL technology applications written in languages that call. In this dynamic link library, it must have a CWinApp inherited from class, DllMain function is provided by the MFC, do not write their own explicit.

c, Extension DLL: used to implement the inherited from the MFC class to re-use, that is, with this type of dynamic link libraries, can be used to output one inherited from the MFC class. It is a function of the output can only be used MFC and dynamically linked to MFC application uses. Can inherit what you want from the MFC, more suitable for your own use class, and to provide it to your application. You are free to give your application to provide MFC or MFC derived class object pointer. Extension DLL to use MFC to create a dynamic link version, and it was only prepared to use MFC class library calls the application. Extension DLLs and Regular DLLs are different, it does not have a class inherited from CWinApp object, so you have to add their own initialization code DllMain function, and the end of the code.

And rules DLL, has the following differences:

1, which does not have a CWinApp derived from the object;
2, it must have a DllMain function;
3, DllMain is called AfxInitExtensionModule function, you must check the return value, if the return 0, DllMmain also return 0;
4, if it wants to output CRuntimeClass types of objects or resources (Resources), you must provide an initialization function to create a CDynLinkLibrary object. Also, it is necessary to initialize the function output;
5, use the MFC extension DLL application must have a class derived from CWinApp, and, generally call the extension DLL InitInstance where the initialization function.

相关文章
  • Three types of MFC DLL 2010-04-15

    Remember reading, in order not to forget, mark look. . a, Non-MFC DLL: refers to the structure without MFC class library, written in direct language with C DLL, the output of the function is generally a standard C interface, and can be written in non

  • MFC扩展DLL中导出类和对话框的实现方法 2014-04-16

    这篇文章主要介绍了MFC扩展DLL中导出类和对话框的实现方法,详细讲述了实现扩展DLL中导出类和对话框的具体步骤与方法,具有不错的实用价值,需要的朋友可以参考下 本文实例讲述了MFC扩展DLL中导出类和对话框的实现方法,分享给大家供大家参考.具体实现方法如下: 一般来说,如果要编写模块化的软件,就要对对动态链接库(DLL)有一定的了解,本人这段时间在修改以前的软件时,决定把重复用的类和对话框做到DLL中,下面就从一个简单的例子讲起,如何实现MFC扩展DLL中导出类和对话框. 程序运行结果如下图所

  • PB used in VC + + compiled DLL 2010-08-13

    This article describes the basic characteristics of the dynamic link library, given the establishment of VC + + DLL and call the VC + + PowerBuilder to create the DLL function of programming examples, achieved through the DLL to connect VC + + PowerB

  • Visual C + +6.0 on the DLL Programming 2010-09-26

    I. Introduction Since Microsoft introduced the Windows 16-bit operating system, the subsequent versions of the Windows operating system for each are very dependent on the dynamic link library (DLL) of functions and data, in fact, almost all of the Wi

  • Dll entry summary (change) 2010-03-13

    Original: DLL entry-summary Yesterday, spent half a day of the DLL technology, there are small gains, finishing up today, to strengthen memory. DLL (Dynamic Link Library), the dynamic link library. 1. About __declspec (dllimport) and __declspec (dlle

  • DLL+ ActiveX控件+WEB页面调用例子 2014-12-17

    因项目需要,开始学习并研究VC.DLL及ActiveX控件,网上资料找了很多,但没一个可用的或者说没一个例子可理解并运行的.没办法,自己研究吧.功夫不负有心人,终有小成了,呵呵,现在把自己学习总结了一下,献给需要的人. 一. 概述 因项目需要,开始学习并研究VC.DLL及ActiveX控件,网上资料找了很多,但没一个可用的或者说没一个例子可理解并运行的.没办法,自己研究吧.功夫不负有心人,终有小成了,呵呵,现在把自己学习总结了一下,献给需要的人. DLL(动态链接库): 分WIN32 DLL和M

  • VC程序在Win32环境下动态链接库(DLL)编程原理 2015-02-01

    这篇文章主要介绍了VC程序在Win32环境下动态链接库(DLL)编程原理,包括了dll文件的原理与具体实现过程,对于深入掌握VC程序设计具有很好的参考借鉴价值,需要的朋友可以参考下 本文详细讲述了VC程序在Win32环境下动态链接库(DLL)编程原理.分享给大家供大家参考.具体分析如下: 一般比较大的应用程序都由很多模块组成,这些模块分别完成相对独立的功能,它们彼此协作来完成整个软件系统的工作.其中可能存在一些模块的功能较为通用,在构造其它软件系统时仍会被使用.在构造软件系统时,如果将所有模块的

  • 在VC中创建DLL文件的方法步骤 2012-03-09

    在VC中创建DLL文件的方法步骤 今天教大家在VC中创建DLL文件的方法步骤,一起来学习一下,并不是很难的,相信聪明的你一看就会. 一.Win32动态链接库 1.制作的步骤: (1)新建WIN32 Dynamic-link Library工程,工程名为MyDll,选择A simple DLL project类型. (2)MyDll.h的内容如下: 以下是引用片段: extern "C" _declspec(dllexport) int sum(int a,int b);//本文所有的例

  • Win32环境下动态链接库(DLL)编程原理 2012-03-09

    比较大应用程序都由很多模块组成,这些模块分别完成相对独立的功能,它们彼此协作来完成整个软件系统的工作.其中可能存在一些模块的功能较为通用,在构造其它软件系统时仍会被使用.在构造软件系统时,如果将所有模块的源代码都静态编译到整个应用程序EXE文件中,会产生一些问题:一个缺点是增加了应用程序的大小,它会占用更多的磁盘空间,程序运行时也会消耗较大的内存空间,造成系统资源的浪费:另一个缺点是,在编写大的EXE程序时,在每次修改重建时都必须调整编译所有源代码,增加了编译过程的复杂性,也不利于阶段性的单元测

  • 转载 浅谈MFC内存泄露检测及内存越界访问保护机制 2012-09-28

    本文所有代码均在VC2008下编译.调试.如果您使用的编译器不同,结果可能会有差别,但本文讲述的原理对于大部分编译器应该是相似的.对于本文的标题,实在不知道用什么表示更恰当,因为本文不仅淡了内存泄露检测机制,也谈到了指针越界的检测机制.到底应该说是MFC的机制,还是C++的机制?Anyway,相信你看了一定会有所收获.并欢迎常来本博客http://lionel.bokee.com留言讨论. 在我们开发MFC应用程序的时候,不知大家是否注意到Debug版本输出窗口经常会有下面这样的信息: Dete

  • VC++动态链接库(DLL)编程[精] 2012-12-07

    1.概论 先来阐述一下DLL(Dynamic Linkable Library)的概念,你可以简单的把DLL看成一种仓库,它提供给你一些可以直接拿来用的变量.函数或类.在仓库的发展史上经历了"无库-静态链接库-动态链接库"的时代. 静态链接库与动态链接库都是共享代码的方式,如果采用静态链接库,则无论你愿不愿意,lib中的指令都被直接包含在最终生成的EXE文件中了.但是若使用DLL,该DLL不必被包含在最终EXE文件中,EXE文件执行时可以"动态"地引用和卸载这个与E

  • 备忘: VC++ 自动适用编译两种模式库文件 (DLL, LIB) 2014-12-26

    一个好的程序设计规划总会有属于自己的基础代码库.重用这些代码库,DLL或LIB方式最好的选择之一.在写新的项目或程序是,我们不可能每次把自己封装好的源代码文件,Copy到新的项目目录下来使用.我们可以把经常需要使用的基础代码,集合到一个DLL库或LIB库中.这样,每次作新的项目开发时,只需要把编译好的DLL或LIB文件以及H头文件COPY过来就行了. DLL库不是我们经常要写的,但在写DLL库时,又怕忘了之前的知识.这里只对一些基本的知识作个备忘.并不断补充. 让自己的基础代码库自动适用编译两种

  • VC + + Keyboard Hook 2010-09-15

    Wince does not support the hook VC hook Learning http://hi.baidu.com/zxchao/blog/item/93b7650e644417c37acbe132.html The following article is reproduced from: http://www.programfan.com/blog/article.asp?id=20338 Personally feel very well written and de

  • (Zz) VC project configuration based 2010-10-13

    One. Preprocessor macros 1. General Macros VC6.0 in: Project Setting> C / C + +> Preprocessor definitions VC2005 in: Project Properties> Configuration Properties> C / C + +> preprocessor defines WIN32: Window 32 system is specified in the c

  • VS project configuration in detail 2011-10-05

    Transfer (http://blog.lehu.shu.edu.cn/Article.aspx?name=byman&aid=333883&g=51f0642a-ea49-45a9-855e-dd0fe49d8195) One. IDE-based configuration 1 font VC6 in "Tools → Options → Format → Font" configure font; VC2005 "Tools → Options →

  • 版权输出台湾香港新加坡---大陆C++超越并引领台湾 2012-03-09

    CSDN著名技术专家著作-<Visual C++2010开发权威指南>版权输出台湾香港新加坡 大陆购买地址 http://product.china-pub.com/196957 台湾购买地址 http://www.iread.com.tw/ProdDetails.aspx?prodid=B000157497 微软公司新一代的开发工具Visual C++ 2010在C++开发方面带来了很多革命性的变化.新的操作系统Windows 7也已经问世,Windows 7的豪华界面与易用性.兼容性,势必

  • VC项目配置基础 2013-03-18

    一.IDE基础配置 1.字体 VC6中"Tools→Options→Format→Font"配置字体:VC2005中"工具→选项→环境→字体和颜色"配置字体. 编写代码一般采用等宽字体,等宽点阵(位图)字体,相对矢量字体而言具有兼容性好和显示清晰的优点.常用的编程等宽字体包括Fixedsys(VC6和notepad御用字体).Consolas.YaHei Mono. VC6默认可选字体只有Fixedsys和Terminal,可通过修改注册表来改字体,在HKEY_CU

  • VC + + compiler in debug mode with the difference between release summary 2010-03-08

    According to the article summed up the network to prepare for inquiries:) The difference between Debug and Release versions Debug and Release are not essentially different, they are only two VC predefined compiler options provided by the set, the com

  • Enable3dControls () and Enable3dControlsStatic () function Introduction 2010-05-25

    Enable3dControls () and Enable3dControlsStatic () Function Description: CWinApp:: Enable3dControls BOOL Enable3dControls (); BOOL Enable3dControlsStatic (); Note: In this section also describes Enable3dControls and Enable3dControlsStatic. Returns: If

  • ACE compile and install, for windows.Linux 2010-07-22

    ACE compile and install, for windows, Linux2006-10-11 09:14 from www.acejoy.com ACE Web Programming Forum 1. Windows for MSVC under the installation and configuration we are using ACE-5.4 + TAO-1.4 + CIAO-0.4.zip, Windows Next unzip the compressed pa