CodePudding user response:
A character encoding differentCodePudding user response:
W represents A for ANSI characters, WIDE characters, don't have the real function SetDlgItemText, but use it every time you use this, he will be based on your program USES what kind of character set, to call SetDlgItemTextA SetDlgItemTextW one of them, you see with the macro definition, use of words, search, casually SetDlgItemText (IDC_EDIT_TEST, _T (" Hello world? NO, World hello "));CodePudding user response:
First understand Chinese GBK encoding and Unicode specific is what happened,Such as: GBK: 0 xb0 0 xa1, Unicode - 16 LE: 0 0 x55 x4a
CodePudding user response:
SetDlgItemText SetDlgItemTextA, SetDlgItemTextWAs relationships between the three:
People, Chinese and foreigners
Or:
People, men and women
The three corresponding character encoding, respectively is:
TCHAR, char, would be/WCHAR
If you want to get the text to the char array, explicitly call SetDlgItemTextA,
If you want to get the text to WCHAR array, explicitly call SetDlgItemTextW,
If you want to get the text to the TCHAR array, call SetDlgItemText,
TCHAR is an uncertain type, may be a char or WCHAR,
SetDlgItemText is a macro name, may be defined as SetDlgItemTextA or SetDlgItemTextW,
Depending on the Visual Studio project Settings as byte code, or Unicode,
SetDlgItemText exist, it is like the existence of TCHAR,
Through the macro definition, makes SetDlgItemText and TCHAR can according to the project code set synchronous switch to the corresponding code,
CodePudding user response:
Most Windows API provides two sets of different version of the character encoding,, the aim is to make your code can be easily transplanted to Unicode project,
CodePudding user response:
Win32 API is generally divided into two kinds of A and W at the end of the corresponding coding ANSI/unicodeUsually A apis are internal conversion ANSI for unicode. The API call again W
CodePudding user response:
# ifdef _UNICODE
# define SetDlgItemText SetDlgItemTextW
# the else
# define SetDlgItemText SetDlgItemTextA
# endif