LPCSTR : Pointer to a constant null-terminated string of 8-bit Windows (ANSI) characters.
LPCTSTR : An LPCWSTR if UNICODE is defined, an LPCSTR otherwise.
LPCWSTR : Pointer to a constant null-terminated string of 16-bit Unicode characters.
LPTSTR : An LPWSTR if UNICODE is defined, an LPSTR otherwise.
LPSTR : Pointer to a null-terminated string of 8-bit Windows (ANSI) characters.
LPWSTR : Pointer to a null-terminated string of 16-bit Unicode characters.
说到底,就是1个字节和两个字节的问题~也就是ANSI和Unicode:
char (1 byte) : Type char is an integral type that usually contains members of the execution character set — in Microsoft C++, this is ASCII. (8-bit Windows (ANSI) characters)
__wchar_t ( 2 bytes) : A variable of __wchar_t designates a wide-character or multibyte character type. By default, wchar_t is a typedef for unsigned short. (16-bit Unicode characters)
A simple example, if you have an application named test.exe
Then you execute c:>text.exe 你好
If you define LPSTR to contain the parameter, the application will crash
Only when you use LPWSTR, the application can work well.