What does AFX_MANAGE_STATE(AfxGetStaticModuleState()) do exactly(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()) 究竟做了什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:AFX_MANAGE_STATE(AfxGetStaticModuleState()) 究竟做了什么
基础教程推荐
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- CString 到 char* 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
