COMMAND和UPDATE_COMMAND_UI处理程序在MFC DLL中未调用 [英] COMMAND AND UPDATE_COMMAND_UI handlers not called in MFC dll

查看:156
本文介绍了COMMAND和UPDATE_COMMAND_UI处理程序在MFC DLL中未调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MFC DLL菜单项的ON_COMMAND和ON_UPDATE_COMMAND_UI处理程序。但他们不被援引。编译为.exe的相同代码具有调用的处理程序。这可能是什么原因?

I have ON_COMMAND and ON_UPDATE_COMMAND_UI handlers for menu items in an MFC dll. But they are not invoked. The same code compiled as .exe has the handlers being invoked. What could be the reason for this?

推荐答案

ON_UPDATE_COMMAND_UI和ON_COMMAND处理程序只有当包含处理程序的对象在命令路由。

ON_UPDATE_COMMAND_UI and ON_COMMAND handler are only called when the object that contains the handler is within the command routing.

所以DLL本身不是问题,但这也取决于你如何创建你的DLL。对于标准DLL和没有共享MFC作为DLL,这将不工作。 AFAIK得到它运行的DLL应该是一个扩展DLL加载到应用程序中。原因是当MFC被静态链接时,主应用程序不能识别标准DLL中的对象。

So the DLL itself isn't the problem but also this depends on how you created your DLL. For a standard DLL and without sharing the MFC as a DLL this will not work at all. AFAIK to get it run the DLL should be an extension DLL loaded into the application. The reason is that the main application wil not recognize your objects in a standard DLL when the MFC is statically linked.

阅读更多关于 MSDN 技术说明

这篇关于COMMAND和UPDATE_COMMAND_UI处理程序在MFC DLL中未调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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