鱼C论坛

 找回密码
 立即注册
查看: 2795|回复: 0

[API档案] GetCommandLine

[复制链接]
发表于 2016-7-14 02:35:00 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
注:本文档由 无符号整形 翻译,小甲鱼校对。

原文链接 -> 传送门

函数功能:

GetCommandLine 函数用于获得当前进程的命令行字符串。


API 函数原型:

  1. LPTSTR WINAPI GetCommandLine(void);
复制代码


参数解析:

这个函数没有参数。


返回值:

返回值是一个指向当前进程命令行字符串的指针。


备注:

1. 用 ANSI C 编写的控制台程序可以使用的 main 函数的 argc 和 argv 参数访问命令行参数。 ANSI GUI 应用程序可以使用 WinMain 函数的参数 lpCmdLine 访问命令行字符串,不包括程序名称。main,WinMain 函数不能返回 Unicode 字符串。

2. 用 C 语言编写的 Unicode 控制台程序可以使用 wmain 或 _tmain 函数访问命令行参数。Unicode 的 GUI 应用程序必须使用 GetCommandLineW 函数来访问 Unicode 字符串。

3. 要将命令行转换为字符串风格数组 argv,请调用 CommandLineToArgvW 函数。


需求:

Minimum supported client Windows XP [仅桌面应用程序 | Windows 商店应用程序]
Minimum supported server Windows 2003 服务器版 [仅桌面应用程序 | Windows 商店应用程序]
Header1. 在 Windows XP, Windows Server 2003、Windows Vista、Windows 7、Windows Server 2008 和 Windows Server 2008 R2 系统上是 WinBase.h(包含于 Windows.h);
2. 在 Windows 8 和 Windows Server 2012 上是 Processenv.h
LibraryKernel32.lib
DLL Kernel32.dll
Unicode and ANSI namesGetCommandLineW (Unicode) 和 GetCommandLineA (ANSI)


【API档案】版权归鱼C工作室(www.fishc.com)所有,转载请注明来源。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-30 17:35

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表