打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
VC 程序片断
userphoto

2010.08.29

关注
/*获取命令行参数, 如果是-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));
 }
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
最完美的C#网络测速(Ping)
EditBox控件中追加一行文字
c++中const的使用方法 在函数前和在后的区别
splitString CString 类型的字符串分割
写一个函数,使给定的一个3×3的二维整型数组转置,即行列互换。
MFC表格控件的简单使用
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服