FindWindowW和FindWindowA的区别(LPCSTR和 LPCWSTR)
函数签名对比
HWND FindWindowA(
[in, optional] LPCSTR lpClassName,
[in, optional] LPCSTR lpWindowName
);
HWND FindWindowW(
[in, optional] LPCWSTR lpClassName,
[in, optional] LPCWSTR lpWindowName
);
LPCSTR和 LPCWSTR 的含义与区别
- LPCSTR: Long Pointer to Constant String
- LPCWSTR: Long Pointer to Constant Wide String
- 区别:wide代表字符串大小为2字节。这样可以处理非ASCII字符,在中文环境下建议使用wide。
参考
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-findwindoww
https://stackoverflow.com/questions/2230758/what-does-lpcwstr-stand-for-and-how-should-it-be-handled-with