/*获取命令行参数, 如果是-a, 则自动运行*/
int CommandLineCount = 0;
LPWSTR * m_lpCommandLine = ::CommandLineToArgvW(GetCommandLineW(), &CommandLineCount);
BOOL result = FALSE;
CString m_strCommandLine;
//获取参数行命令
for(int i = 0; i < CommandLineCount; i ++)
{
m_strCommandLine = m_lpCommandLine[i];
if(0 == m_strCommandLine.MakeLower().Compare(_T("-a")))
{
OutPutLog(_T("Auto run!"), TEST_LOG);
OnBnClickedStartchange();
}
else if(0 == m_strCommandLine.MakeLower().Compare(_T("-bi")))
{ //begin index
m_strCommandLine = m_lpCommandLine[++ i];
m_dwCurMaxRecordId = atol(m_strCommandLine.GetString());
}
}
//--->
//设置应用程序所在目录为当前目录
TCHAR strCurFileNameCh[255];
GetModuleFileName(NULL, strCurFileNameCh, 255);
CString strCurFileName = strCurFileNameCh;
if(!strCurFileName.IsEmpty())
{
int nIndex = 0;
int nOIndex;
while(nIndex >= 0)
{
nOIndex = nIndex;
nIndex = strCurFileName.Find('\\', nIndex + 1);
}
SetCurrentDirectory(strCurFileName.Left(nOIndex + 1));
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。