MSDN里的定义: LPOLESTR, LPCOLESTR ——— An OLE wide character pointer 就是说,szPrintDoc是一个UniCode字符串,L"PrintOut"是标准的写法,如果你不习惯,可以用_T宏来。 For example, the following code: CString strName = _T("Name"); is translated as a Unicode string if _UNICODE is defined or as an ANSI string if not. For more information, see the article Strings: Unicode and Multibyte Character Set (MBCS) Support.
确切定义:L表示你这个字符串为Unicode字符串!
当有字符串前有L,编译串把这个字符串当作Unicode来处理,否则为Ansi字符串来处理。
当有字符串前有L,编译串把这个字符串当作Unicode来处理,否则为Ansi字符串来处理。
在字符串前的大写"L"告诉编译器这个字符串应被编译成 Unicode 字符串。而缺省时,Visual C++ 编译器把所有的字符串当作 ANSI 字符串而不是 Unicode 字符串编译。
则L"...."或L'.'表示将"...."或'.'转化为相应的Unicode码
LPOLESTR, LPCOLESTR ——— An OLE wide character pointer
就是说,szPrintDoc是一个UniCode字符串,L"PrintOut"是标准的写法,如果你不习惯,可以用_T宏来。
For example, the following code:
CString strName = _T("Name");
is translated as a Unicode string if _UNICODE is defined or as an ANSI string if not. For more information, see the article Strings: Unicode and Multibyte Character Set (MBCS) Support.