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);
}
阅读(1506) | 评论(0) | 转发(0) |