Click here to Skip to main content
15,068,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Richard MacCutchan 16-Dec-12 8:44am
Well your call to the function does not match its signature so the compiler is telling you to use a cast to show that you understand what you are doing. But we need to see the relevant parts of the code to be sure of the solution. Please use the "Improve question" link to add the relevant information to your query.

1 solution

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().

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900