2013年7月14日

获取环境变量

摘要: PTSTR pszValue = NULL;PCTSTR pszVariableName = TEXT("JAVA_HOME");// Get the size of the buffer that is required to store the valueDWORD dwResult = GetEnvironmentVariable(pszVariableName, pszValue, 0); if (dwResult != 0){// Allocate the buffer to store the environment variable value DWORD s 阅读全文

posted @ 2013-07-14 10:55 Sunny_NUAA 阅读(248) 评论(0) 推荐(0)

获取进程命令行参数

摘要: 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 @ 2013-07-14 10:31 Sunny_NUAA 阅读(596) 评论(0) 推荐(0)

导航