MFC DLL ON_REGISTERED_MESSAGE [英] MFC DLL ON_REGISTERED_MESSAGE

查看:130
本文介绍了MFC DLL ON_REGISTERED_MESSAGE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们。我试图在一个dll中收到一些消息,我已经写了哪些链接与共享dll中的mfc。



我试图使用ON_WM_CLIPBOARDUPDATE()和ON_REGISTERED_MESSAGE()一些自定义消息。



然而我收到了这个错误:





错误C2440 :''static_cast'':无法从''void(__ thiscall CRedDllApp :: *)(void)''转换为''void(__thiscall CWnd :: *)(void)''



指向的类型不相关;转换需要reinterpret_cast,C风格的演员或功能风格的演员



我对于我要做些什么来修复它有点困惑。任何帮助将不胜感激。

解决方案

为了接收消息,您需要创建一个窗口。它可以是任何窗口,隐藏的窗口都可以。然后你需要在那里创建消息处理程序。



从您提供的错误消息看来,您似乎正在尝试将CRedDllApp用作消息接收器。 />


开始时最简单的方法是阅读这个 [ ^ ]文章。



将窗口添加到项目后,创建它CRedDllApp :: InitInstance中()。在CRedDllApp :: ExitInstance()上销毁它。


hi guys. Im trying to recieve some messages in a dll i''ve written which links with mfc in a shared dll.

im trying to use ON_WM_CLIPBOARDUPDATE() and ON_REGISTERED_MESSAGE() with some custom messages.

however i get this errors on them:


error C2440: ''static_cast'' : cannot convert from ''void (__thiscall CRedDllApp::* )(void)'' to ''void (__thiscall CWnd::* )(void)''

Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

and i''m a bit confused as to what i have to do to fix it. any help would be much appreciated.

解决方案

In order to receive messages you need to create a window. It could be any window, a hidden one will do. Then you need to create the message handlers there.

From the error message you have provided it looks like you are trying to use the CRedDllApp as a message receiver.

The simplest thing for you to get started is to read this[^] article here at Codeproject.

Once you have added the window to the project, create it in CRedDllApp::InitInstance(). Destroy it on CRedDllApp::ExitInstance().


这篇关于MFC DLL ON_REGISTERED_MESSAGE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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