我用一个exe调用dll,通过dll生成一个窗体用该如何实现!有没有例子可以看一下!谢谢各位

解决方案 »

  1.   

    一步一步实现MFC扩展DLL中导出类和对话框
    http://tech.ddvip.com/2007-03/117396292221262.html
      

  2.   

    HINSTANCE gdll;
    extern "C" __declspec(dllexport) void Opendlg()
    {
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    AfxMessageBox("3");
    dlg *dlgdlg;
    dlgdlg = new dlg;
    dlgdlg->Create(dlg::IDD);
    dlgdlg->ShowWindow(SW_SHOW);
    } BOOL CGameApp::InitInstance() 
    {
    // TODO: Add your specialized code here and/or call the base class
    gdll =  LoadLibrary("gamedll.dll");
    AfxSetResourceHandle(gdll);
    return CWinApp::InitInstance();
    }
      

  3.   

    其实也没必要使用MFC扩展DLL,使用的时候还要定一个类的对象,直接使用MFC Regular DLL我觉得更好。另外注意主程序和dll的资源的切换。网上Google+百度应该可以搜到很多例子。