Click here to Skip to main content
15,921,382 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
When i migrating VC 6.0 to VS 2010.i got
error C2440: 'static_cast' : cannot convert from 'void (__thiscall CDlgDPMonitor::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'

PLease help me .

Thanks inadvance
Updated 4-Oct-12 22:24pm
Richard MacCutchan 5-Oct-12 4:25am    
Show the code where the error occurs.

1 solution

VS2010 and the MFC library have gotten more strict on enforcing type matching of APIs. Most MFC APIs return an LRESULT and you have your routine defined to return VOID so you're getting the "cannot convert" error.

Find the line, identify the API call you are making, look up the declaration of the function that MFC wants and fix your code to match. In the past, you could get away with not returning an LRESULT for some routines but if the API is expecting a return value, you need to provide one.

You could get a better answer by actually posting the relevant code that got the error, not just posting the error message.
Share this answer

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