获取进程命令行参数

 TRACE1("%s\n", GetCommandLineW());//获取命令行参数
 OutputDebugStringW(GetCommandLineW());
 int argNum;
 PWSTR *ppArgv = CommandLineToArgvW(GetCommandLineW(),&argNum);//将参数转成数组
 for (int i=0;i<argNum;i++)
 {
  OutputDebugStringW(ppArgv[i]);
 }
 HeapFree(GetProcessHeap(),0,ppArgv);//ppArgv为系统内部分配的内存可以不释放,但在进程结束时系统释放

posted on 2013-07-14 10:31  Sunny_NUAA  阅读(590)  评论(0)    收藏  举报

导航