Error c2440 "static_cast" cannot be converted from "void (_ thiscall cpppview) (void)" to "lresult (_ thiscall

Source: Internet
Author: User
Error c2440

"Static_cast" cannot be converted from "void (_ thiscall cpppview) (void)" to "lresult (_ thiscall cwnd) (wparam, lparam )"

 

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 be converted from "void (_ thiscall cpppview: *) (void)" to "lresult (_ thiscall cwnd: *) (wparam, lparam) "does not have a function with this name 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)LresultCtransparentwnd: onliben (wparam, lparam), the declaration must also be changed, such as afx_msg
LresultOnliben (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 ).
From: http://hi.baidu.com/mike_youyou/item/c685c11212bf998a99ce33a7

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.