Error c2664: "cwnd: messageboxw": you cannot convert parameter 1 from "const char [17]" to "lpctstr"

Source: Internet
Author: User


Add an event handler to a menu item in MFC:


1.     VoidCmainframe: ontest () 

2.     { 

3.           MessageBox ("YouClickedMenuItem ."); 

4.           //Todo:Add command handler code here  

5.     } 

The following error is reported during compilation: Error c2664: "cwnd: messageboxw": parameter 1 cannot be converted from "const char [17]" to "maid''

The solution is as follows:

Method 1:

Add _ t before the Parameter

That is, MessageBox (_ t "you clicked menu item .");

Method 2:

When creating a project, cancel the use of the Unicode character set, for example, set to not set

Method 3:

Modify the value of the following attribute [character set] to [use multi-Byte Character Set]



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.