Jump to content
  • Advertisement
Sign in to follow this  
Robert B Colton

C++ LPCWSTR conersion problem

This topic is 3026 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Your release build probably has the property "Character Set" set to Unicode. Either change this to Multi-Byte or you need to prefix your string with an L. So it would look like this:


wnd_Structure.lpszClassName = L"WindowClassName";



Share this post


Link to post
Share on other sites
I hear you. I jumped from C# to C++ about 6 months ago and I had the exact same problem.

I will add that you should be aware that changing to a Multibyte character set means you are forcing your application to use the UTF-8 standard. Personally, I like the UTF-8 standard because you can mix single byte characters with multibyte characters. However, most people have defaulted to the Unicode character set which is UTF-16. It uses 2 bytes to represent all characters in a string and is less cumbersome because of that.

Also, the way Microsoft defines the two Character sets is a bit misleading because the Unicode set is "multibyte" and the Multibyte set is a Unicode format.

Share this post


Link to post
Share on other sites
Quote:
Original post by enigmatix
I hear you. I jumped from C# to C++ about 6 months ago and I had the exact same problem.

I will add that you should be aware that changing to a Multibyte character set means you are forcing your application to use the UTF-8 standard.

No. It stores it in "multi byte" format, which can mean anything really from UTF-8 to any number of other encodings. It's not recommended for general usage really because there IS no standard encoding used (in other words, its up to the strings you pass in, and how they are encoded).
Quote:
However, most people have defaulted to the Unicode character set which is UTF-16. It uses 2 bytes to represent all characters in a string and is less cumbersome because of that.

Also wrong, the unicode character set has many different encodings, of which UTF-8, UTF-16, and UTF-32 are all members of. Wide character support in VS assumes UTF-16 character set however.
Quote:

Also, the way Microsoft defines the two Character sets is a bit misleading because the Unicode set is "multibyte" and the Multibyte set is a Unicode format.


See above. There is a reason why this function takes so many parameters and has so many options.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!