在MFC应用程序中显示来自不同DLL的对话资源 [英] Displaying a dialog resource from a different DLL in MFC application

查看:152
本文介绍了在MFC应用程序中显示来自不同DLL的对话资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Win32资源DLL(No MFC),它有一个对话框。



我可以使用 LoadLibrary加载Win32 dll



加载DLL后,如何将对话框显示给用户?



如果有人可以共享代码,我将不胜感激。



我记得使用 AfxGetResourceHandle 做这样的东西,但现在不记得了

解决方案

基本步骤是:


  1. LoadLibrary (如你所做)

  2. FindResource 你是HRSRC)

  3. LoadResource (给你一个HGLOBAL)

  4. LockResource (为您提供一个您可以转换为LPCDLGTEMPLATE的LPVOID)

  5. CreateDialogIndirectParam (创建对话框)


I have a Win32 resource DLL (No MFC), which has a dialog in it.

I can load the Win32 dll using LoadLibrary from the MFC application.

After loading the DLL, how do I bring up the dialog to show it to the user?

I Would appreciate if someone can share the code to do this.

I remember using AfxGetResourceHandle to do this kind of stuff, but don't remember it now.

解决方案

The basic steps are:

  1. LoadLibrary (as you have done)
  2. FindResource (gives you an HRSRC)
  3. LoadResource (gives you an HGLOBAL)
  4. LockResource (gives you an LPVOID which you can cast to LPCDLGTEMPLATE)
  5. CreateDialogIndirectParam (creates the dialog)

这篇关于在MFC应用程序中显示来自不同DLL的对话资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆