MFC extension dll怎么会是这样的???
我觉得按书上讲的这应该是Regular dll的样子嘛,我用如果选择生成regular dll
却是一个派生自CWinApp的类.是不是这个才是MFC extension dll????// extendsiondll.cpp : Defines the initialization routines for the DLL.
//#include "stdafx.h"
#include <afxdllx.h>#ifdef _DEBUG
#define new DEBUG_NEW
#endifstatic AFX_EXTENSION_MODULE extendsiondllDLL = { NULL, NULL };extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
// Remove this if you use lpReserved
UNREFERENCED_PARAMETER(lpReserved); if (dwReason == DLL_PROCESS_ATTACH)
{
TRACE0("extendsiondll.DLL Initializing!\n");

// Extension DLL one-time initialization
if (!AfxInitExtensionModule(extendsiondllDLL, hInstance))
return 0; // Insert this DLL into the resource chain
// NOTE: If this Extension DLL is being implicitly linked to by
//  an MFC Regular DLL (such as an ActiveX Control)
//  instead of an MFC application, then you will want to
//  remove this line from DllMain and put it in a separate
//  function exported from this Extension DLL.  The Regular DLL
//  that uses this Extension DLL should then explicitly call that
//  function to initialize this Extension DLL.  Otherwise,
//  the CDynLinkLibrary object will not be attached to the
//  Regular DLL's resource chain, and serious problems will
//  result. new CDynLinkLibrary(extendsiondllDLL); }
else if (dwReason == DLL_PROCESS_DETACH)
{
TRACE0("extendsiondll.DLL Terminating!\n"); // Terminate the library before destructors are called
AfxTermExtensionModule(extendsiondllDLL);
}
return 1;   // ok
}

解决方案 »

  1.   

    好像.NET下生成的和6.0下生成的不一样的!
      

  2.   

    问题就是这样子的阿,这是regular dll,我知道,但在我的.net中是选择MFC extension dll这一项默认生成的, 不解???而如果选择regular dll生成的却是一个派生自cwinapp的类.??????????????//
      

  3.   

    你没有搞懂这个选项的含义
    这个选项是指如何使用MFC库,如果是regular dll,那么编译器使用的MFC的lib文件是完整的,这样生成的DLL的内部就包括了MFC的类和函数,这样你的DLL文件就会大一些。
    如果是extension dll,使用的lib文件就只包括到MFC的DLL的接口,你的DLL中并不包含MFC的类和函数。
    这个只是编译器的选项,至于源代码,你爱怎么写怎么写。