我用exe程序加载了一个有对话框的dll文件,怎么才能只显示DLL中的对话框还不显示EXE中的对话框,编译器是VS2008

解决方案 »

  1.   

    怎么才能只显示DLL中的对话框还不显示EXE中的对话框
    这话啥意思,发音要正确
      

  2.   

    楼主看这里:资源模块切换 void CSharedDllCallDlg::OnCalldllButton() 
    {
     //方法3:由应用程序本身进行状态切换
     //获取EXE模块句柄 HINSTANCE exe_hInstance = GetModuleHandle(NULL);  //或者HINSTANCE exe_hInstance = AfxGetResourceHandle(); 
     //获取DLL模块句柄 HINSTANCE dll_hInstance = GetModuleHandle("SharedDll.dll"); 
     AfxSetResourceHandle(dll_hInstance); //切换状态
     ShowDlg(); //此时显示的是DLL的对话框 
     AfxSetResourceHandle(exe_hInstance); //恢复状态 //资源模块恢复后再调用ShowDlg
     ShowDlg(); //此时显示的是EXE的对话框
    }