GetCommandLine [API]

GetCommandLine

  GetCommandLine
  The GetCommandLine function retrieves the command-line string for the current process.
  LPTSTR GetCommandLine(void);
  Parameters
  This function has no parameters.
  Return Values
  The return value is a pointer to the command-line string for the current process.
  Remarks
  ANSI console processes written in C can use the argc and argv arguments of the main function to access the command-line arguments. ANSI GUI applications can use the lpCmdLine parameter of the WinMain function to access the command-line string, excluding the program name. The reason that main and WinMain cannot return Unicode strings is that argc, argv, and lpCmdLine use the LPSTR data type for parameters, not the LPTSTR data type. The GetCommandLine function can be used to access Unicode strings, because it uses the LPTSTR data type.
  To convert the command line to an argv style array of strings, call the CommandLineToArgvW function.
  Note The name of the executable in the command line that the operating system provides to a process is not necessarily identical to that in the command line that the calling process gives to the CreateProcess function. The operating system may prepend a fully qualified path to an executable name that is provided without a fully qualified path.
  Requirements
  Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, and Windows 95.
  Server: Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server.
  Unicode: Implemented as Unicode and ANSI versions on all platforms.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Kernel32.lib.
  See Also
  Processes and Threads Overview, Process and Thread Functions, CommandLineToArgvW, CreateProcess, WinMain
  [声明]
  Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineA" () As String
  [说明]
  获得指向当前命令行缓冲区的一个指针
  [返回值]
  Long,命令行缓冲区在内存中的地址
  [其它]
  Visual Basic Command函数更易获取参数,但它未提供可执行的名称。使用这个函数时,要求进行内存复制操作
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值