Chinaunix首页 | 论坛 | 博客
  • 博客访问: 81484
  • 博文数量: 22
  • 博客积分: 1040
  • 博客等级: 少尉
  • 技术积分: 291
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-15 11:20
文章分类

全部博文(22)

文章存档

2009年(1)

2008年(21)

我的朋友

分类: C/C++

2008-05-29 09:24:37

 
调用某个.exe文件
CString path,strSaveFile;
 ::GetModuleFileName(NULL,path.GetBuffer(MAX_PATH),MAX_PATH);
 path.ReleaseBuffer();
 path = path.Left(path.ReverseFind('\\'));
 strSaveFile.Format("%s\\update.exe",path);
 CString strCmdParam;
 strCmdParam.Format("%s %.3f %s\\up\\update.ini|stard",theHostParam.m_strAppTitle,theHostParam.m_fAppVer,CMainFrame::m_taiShanDoc->m_SystemInitData.NetAddr);
 ::ShellExecute( m_hWnd, "open", strSaveFile, strCmdParam, NULL, SW_SHOWNORMAL);
 
update.exe端接收strCmdParam参数:
 
1:/*CString   x;  
 x.Format("%d,     %s,     %S,     %s",__argc,__argv[1],__argv[2],__argv[3]);  
 MessageBox(x);  
 */
 CString x;
 x.Format("%s",__argv[3]);
 int n=x.ReverseFind('|');
 x = x.Right(x.GetLength()-n-1);
 AfxMessageBox(x);
 
2:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNew;
 
CString strFileName=cmdInfo.m_strFileName;
//AfxMessageBox(UserID);
//strFileName="JnwInsideInfo.exe     |20082008";
int ipos=strFileName.ReverseFind('|');
if(ipos>-1)
{
 g_UserID=strFileName.Right(strFileName.GetLength()-(ipos+1));
  //AfxMessageBox(g_UserID);
}
 
 
 
阅读(1468) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:const用法

给主人留下些什么吧!~~