It has nothing to do with the type to be pointed to; conversion requires reinterpret_cast, C style conversion or function style Conversion

Source: Internet
Author: User


1 error c2440: "=": cannot be converted from "const char [14]" to "lpcwstr"
1> it has nothing to do with the type to be pointed to; conversion requires reinterpret_cast, C style conversion or function style Conversion
1> parameter 2 cannot be converted from "const char [14]" to "lpcwstr"
1> it has nothing to do with the type to be pointed to; conversion requires reinterpret_cast, C style conversion or function style Conversion
1> parameter 2 cannot be converted from "char [20]" to "lpcwstr"
1> it has nothing to do with the type to be pointed to; conversion requires reinterpret_cast, C style conversion or function style Conversion

If you assign a value to a cstring directly, such as cstring STR = "char", or directly enter "char" in the function parameter, or assign a value to a string, the preceding error occurs. You can solve this problem using either of the following methods:


1. Add text before the content (invalid variable), such as MessageBox (hwnd, szchar, text ("char"), 0 );------


UNICODE: converts all strings to text ("") or _ T ("")
For example,


ABC. lpszclassname = "fb2009"; should be changed


ABC. lpszclassname = _ T ("fb2009 ");


To do this, you also need to include the tchar. h header file.


2. In Project Properties> General, change the uicode to multi-character segments.
Configuration properties-> C/C ++-> pre-processor Definition
Check whether Unicode/_ Unicode exists. If yes, remove it and check again.ProgramIs there define?

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.