经google,找到如下:
The plain versions without the underscore affect the character set the Windows header files treat as default. So if you define UNICODE
, then GetWindowText
will map to GetWindowTextW
instead of GetWindowTextA
, for example. Similarly, the TEXT
macro will map to L"..."
instead of "..."
.
The versions with the underscore affect the character set the C runtime header files treat as default. So if you define _UNICODE
, then _tcslen
will map to wcslen
instead of strlen
, for example. Similarly, the _TEXT
macro will map to L"..."
instead of "..."
.
Looking into Windows SDK you will find things like this:
#ifdef _UNICODE#ifndef UNICODE#define UNICODE#endif#endif
以上大意就是:没带下划线的UNICODE主要是针对Windows的头文件。
带下划线的_UNICODE主要是针对C运行库的。
所以自定义时,最好两种都应定义。
时间: 2024-10-13 10:06:34