c++ - WinMain 和 wWinMain 的区别

标签 c++ windows winapi unicode

唯一的区别是 Winmain 使用 char* 作为 lpCmdLine 参数,而 wWinMain 使用 wchar_t*。

在 Windows XP 上,如果应用程序条目是 WinMain,Windows 是否会将命令行从 Unicode 转换为 Ansi 并传递给应用程序?

如果命令行参数必须是Unicode(比如Unicode文件名,转换会导致一些字符丢失),是不是说我必须使用wWinMain作为入口函数?

最佳答案

On Windows XP, if an application entry is WinMain, does Windows convert the command line from Unicode to Ansi and pass to the application?

是的。

If the command line parameter must be in Unicode (for example, Unicode file name, conversion will cause some characters missing), does that mean that I must use wWinMain as the entry function?

是的,如果您想正确处理程序的 Unicode 参数,您应该这样做。

文档发送至 WinMain() on MSDN也同意。

不过,您也可以使用 GetCommandLineW 专门以 Unicode 检索命令行。

关于c++ - WinMain 和 wWinMain 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1792275/

相关文章:

c++ - 模板元编程 : "does not have integral or enumeration type"

c++ - CMake 使用错误的链接器标志(动态与静态)

windows - 如何生成字符串类型ID的资源条目?

c++ - 使用 Kerberos 身份验证模拟用户时建立 ODBC 连接

php - OpenCV & PHP & XAMPP

windows - 使用 VirtuaWin 时,资源管理器窗口的 GetWindowRect 值非常负

c++ - 智能感知 :expected a declaration in C++

c++ - 使用包含 3001 位数字的非常大的整数

c# - 如何从 C# 中的代码打开 Windows 设置页面?

windows - 是否需要从 Windows SDK 重新分发 DirectX?