AFX_MANAGE_STATE(AfxGetStaticModuleState()) 究竟做了什么 [英] What does AFX_MANAGE_STATE(AfxGetStaticModuleState()) do exactly

查看:14
本文介绍了AFX_MANAGE_STATE(AfxGetStaticModuleState()) 究竟做了什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了很多模态对话框,它们在不使用 AFX_MANAGE_STATE 的情况下运行良好,但最近我正在处理一个不同的项目,其中资源 dll 与启动 dll 不同.我在网上冲浪并发现了上面的行,当我在启动对话框之前插入它时,它起作用了.我想可能是因为我们有不同的 dll,我们需要加载主 dll 的状态才能启动对话框,但我不确定.我无法在互联网上的任何地方找到一个好的解释.谁能简单地解释一下 AFX_MANAGE_STATE 的作用以及为什么我突然不得不使用它.

I have used a lot of modal dialogs and they worked fine without the use of AFX_MANAGE_STATE, but recently I was working on a different project in which the resource dlls are different from the launching dll. I surfed the web and found out the above line and when I inserted it before launching the dialog, it worked. I guess that maybe since we have different dlls, we need to load the state of the main dll in order to launch the dialog, but I am not sure. I have not been able to find a good explanation anywhere on the internet. Could anyone please explain in simple terms what AFX_MANAGE_STATE does and why I suddenly had to use it.

谢谢.

推荐答案

每个 .exe 和 .dll 都有一个内部资源句柄,指向您的对话框和其他资源.如果调用DLL中的函数,当前资源句柄指向的是.exe中的资源,这是错误的,需要改成DLL的资源.

Every .exe and .dll has an internal resource handle, pointing to your dialogs and other resources. If you call a function in your DLL, the current resource handle is pointing to the resources in the .exe, which is wrong and needs to be changed to the resources of the DLL.

这就是 AFX_MANAGE_STATE 所做的.

这篇关于AFX_MANAGE_STATE(AfxGetStaticModuleState()) 究竟做了什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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