你只要在你的要使用DLL的程序中将这个DLL加入你程序的资源链中就行了。或者干脆将资源链指定为这个DLL。
HINSTANCE old = AfxGetResourceHandle();
AfxSetResourceHandle(hInst);
// load resource here
          .......
AfxSetResourceHandle(old) ;

解决方案 »

  1.   

    [email protected] 谢谢啦 :)
      

  2.   

    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)
    {
    // Extension DLL one-time initialization
    if (!AfxInitExtensionModule(PublicDLL, hInstance))
    return 0;
    afxCurrentInstanceHandle = hInstance;
    afxCurrentResourceHandle = hInstance; // 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(PublicDLL);
    }
    else if (dwReason == DLL_PROCESS_DETACH)
    {
    // Terminate the library before destructors are called
    AfxTermExtensionModule(PublicDLL);
    }
    return 1;   // ok
    }
      

  3.   

    HINSTANCE hInst = AfxGetResourceHandle();
    AfxSetResourceHandle( GetModuleHandle("XXX.dll"));
    CBitmap map;
    map.LoadBitmap(IDB_BITMAPTREE);//XXX.dll中得位图资源
    ...............
    map.Detach ();
    AfxSetResourceHandle( hInst );
      

  4.   

    这种资源DLL的,我做了一个,我是在SDI客户区中实际的从资源DLL读入位图并显示
    演示文档下载地址
    http://www.csdn.net/filebbs/read_topic.asp?id=385 
      

  5.   

    虽然不是在对话框中,但原理是一致的
    >AVI资源如果放在了DLL中,如何在对话框中使用
    可以将AVI提取出来保存在临时文件中,或直接将资源DLL设置为当前资源DLL
      

  6.   

    如果是在DLL中导出资源,应用程序中不需要添加额外的代码。