示例#1
0
CStrVector CFilesHashDlg::ParseCmdLine()
{
	// 从命令行获取文件路径
	CStrVector Parameters;

#if defined(UNICODE) || defined(_UNICODE)
	size_t cmdLen = wcslen(theApp.m_lpCmdLine);
#else
	size_t cmdLen = strlen(theApp.m_lpCmdLine);
#endif

	if(cmdLen > 0)
	{
		for(size_t i = 0; i < cmdLen; ++i)
		{
			CString Parameter("");
			if(theApp.m_lpCmdLine[i] == '"')
			{
				++i;
				for(; theApp.m_lpCmdLine[i] != '"'; ++i)
					Parameter.AppendChar(theApp.m_lpCmdLine[i]);
				Parameters.push_back(Parameter);
				++i;
			}
			else
			{
				for(; theApp.m_lpCmdLine[i] != ' '; ++i)
					Parameter.AppendChar(theApp.m_lpCmdLine[i]);
				Parameters.push_back(Parameter);
			}
		}
	}
	// 从命令行获取文件路径结束
	return Parameters;
}
示例#2
0
文件: H3CDlg.cpp 项目: sunjw/h3c_nuaa
CStrVector CH3CDlg::ParseCmdLine()
{
	// 从命令行获取文件路径
	CStrVector parameters;
	tstring tstrCmdLine(theApp.m_lpCmdLine);
	size_t cmdLen = tstrCmdLine.length();
	if(cmdLen > 0)
	{
		for(size_t i = 0; i < cmdLen; ++i)
		{
			CString para(_T(""));
			if(tstrCmdLine[i] == _T('"'))
			{
				++i;
				for(; i < cmdLen && tstrCmdLine[i] != _T('"'); ++i)
					para.AppendChar(tstrCmdLine[i]);

				parameters.push_back(para);
				++i;
			}
			else
			{
				for(; i < cmdLen && tstrCmdLine[i] != _T(' '); ++i)
					para.AppendChar(tstrCmdLine[i]);

				parameters.push_back(para);
			}
		}
	}
	// 从命令行获取文件路径结束
	return parameters;
}