WinMain 命令行参数 [英] WinMain command line arguments
问题描述
WinMain 的第三个参数以未处理的字符串形式提供命令行.虽然这可能有助于您处理通配符的扩展以及诸如此类的问题,但是否有可能在 Win32 API 中潜伏着某种方法来获取它的常用 C argc、argv 版本?
The 3rd param to WinMain provides the command line as an unprocessed string. While that may be useful for allowing you to cope with expansion of wildcards and what-not, is there any chance that lurking somewhere in the Win32 API that there's a way to get the usual C argc, argv version of it?
推荐答案
您可以使用 CommandLineToArgvW()
转换为 argv 样式的 Unicode 字符串数组.不幸的是,没有 ANSI 字符串版本.另外,请注意这不会将 argv[argc]
(即最后一个参数之后的元素)设置为 NULL.
You can use CommandLineToArgvW()
to convert to an argv-style array of Unicode strings. Unfortunately, there is no ANSI-string version. Also, beware that this does not set argv[argc]
(i.e. the element after the last argument) to NULL.
这篇关于WinMain 命令行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!