Error c2440 "static_cast" cannot be converted from "void (_ thiscall cpppview) (void)" to "lresult (_ thiscall cwnd) (wparam, lparam )"
You cannot even sweat when writing different values!
You cannot convert void (_ thiscall cmainframe: *) (void) to lresult (_ thiscall cwnd: *) (wparam, lparam) development platform from vc6.0 to vs2005, you need to migrate the original project.
Similar errors may occur:
Error c2440: 'static _ cast': cannot convert from 'void (_ thiscall cmainframe ::*)
(Void )'
To 'lresult (_ thiscall cwnd: *) (wparam, lparam )'
Vs2005 checks messages more strictly. Previously, the message ing that was completely normal under vc6 failed to be compiled under vs2005.
On_message (wm_message, onmymessage );
The onmymessage return value must be lresult, in the form of afx_msg lresult onmymessage (wparam, lparam). If not, an error message is displayed:
Error c2440: "static_cast": cannot be converted from "void (_ thiscall cpppview: *) (wparam, lparam)" to "lresult (_ thiscall cwnd ::*) (wparam, lparam) "does not have a function with this name within the range that matches the target type
Error c2440: "static_cast": cannot start from "void (_ thiscall cpppview ::*)
(Void) "is converted to" lresult (_ thiscall cwnd: *) (wparam, lparam) ". No function with this name exists within the range matching the target type.
The solution is as follows:
For example, on_message (wm_liben, onliben) in transparentwnd. cpp ):
First, change the type of the original message function return value to lresult (locate the onliben definition, as shown in figureViodCtransparentwnd: onliben (wparam, lparam)Lresult
Ctransparentwnd: onliben (wparam, lparam), the declaration must also be changed, such as afx_msgLresult
Onliben (wparam, lparam ););
Second, you can write a return statement in the function.True;
Third, the parameters of the message function must be rewritten(Wparam, lparam)Whether or not these two parameters are obtained;
Fourth: Message ing, as shown in figureOn_message (wm_message, & onmymessage ).
Reposted from: http://hi.baidu.com/?#####/blog/item/03fa9c1573c1171c314e155b. Html