HWND wndHandle; //global variable // code snipped WNDCLASSEX wcex; // code snipped wcex.lpszClassName = (LPCWSTR) "MyTitleName"; // code snipped wndHandle = CreateWindow( (LPCWSTR)"MyTitleName", //the window class to use (LPCWSTR)"MyTitleName", //the title bar text ... ...
I am following a tutorial for windows window. The above code is used to set the title bar of a window. The compiler yells at me: βit is impossible to convert fromβ const char [12] βtoβ LPCWSTR β, so well, I came up with my lineβ MyTitleName βwith (LPCWSTR), and everything compiled just fine. However, the window title bar is executed at runtime turns out to be Chinese. I tried changing the line around and Chinese characters always change according to my line. I use XP Visual C ++ 2008 Express Edition and I got English (US) as the setting for non-unicode programs. I don't I understand, why does the string become Chinese?
( ). , , Windows API, , : L"MyTitleName". LPCWSTR, , -, .
L"MyTitleName"
:
wcex.lpszClassName = L"MyTitleName"; // code snipped wndHandle = CreateWindow( L"MyTitleName", //the window class to use L"MyTitleName", //the title bar text ...
, : "" Character Set Use Multi-Byte Character Set. - , - .
Character Set
Use Multi-Byte Character Set
- (LPCWSTR). , , - . - Unicode . Fix:
wcex.lpszClassName = L"MyTitleName"; wndHandle = CreateWindow( L"MyTitleName", //the window class to use L"MyTitleName", //the title bar text
Source: https://habr.com/ru/post/1729427/More articles:ΠΡΠΎΠ³ΡΠ°ΠΌΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ Π² Unix: ΡΠΎΠ²ΠΌΠ΅ΡΡΠ½ΠΎΠ΅ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠ΅ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊ Ρ Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ°ΠΌΠΈ - c(Eclipse RCP) How to get editor link in command handler - eclipseTCP / IP Port Binding Question - networkinghttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1729425/how-to-limit-web-site-access-to-usa-or-north-america-only&usg=ALkJrhg8w3rooD3BkRU-KxIfcMLwLkBz3AOne active IB transaction in the life of one user application - databasejQuery / JS removing / trimming trailing html lines? - javascriptSpring - IoC Container - How to use dynamic values ββin properties? (for example, concat of 2 lines) - javaJQuery Flyout Menu - jqueryReplace SQL Server Database - databaseInstalling Android application via USB - androidAll Articles