if (Id == IDM_SEND_REG_MSG)
{
CString strAllAccounts = _T("");
CString strCmd=_T("");
strCmd="D:\\Program Files\\Tencent\\RTXC\\Plugins\\menudemo\\SmartWord.exe "; if (Type!=RTXC_UI_TYPE_IM_THIRDPARTY) {
strAllAccounts = GetStructUser(Parameter);
}
else{
strAllAccounts = GetIMThirdUser(Parameter);
}
strCmd=strCmd+strAllAccounts;
AfxMessageBox(strCmd);
//WinExec((LPSTR)(LPCTSTR)strCmd,SW_SHOWNORMAL);   //这里没有任何反映
//WinExec("D:\\Program Files\\Tencent\\RTXC\\Plugins\\menudemo\\SmartWord.exe hunter",1);//这里可以调用成功
}
拼出来的字符串和下面这句是一样的,为啥调用不了那个EXE?

解决方案 »

  1.   

    strCmd="cmd /c D:\\Program Files\\Tencent\\RTXC\\Plugins\\menudemo\\SmartWord.exe ";
    这样吗?
      

  2.   

    WinExec("\"C:\\Program Files\\MyApp.exe\" -L -S", ...)
    MSDN中调用时用冒号把可执行文件括起来的,是为了在让路径有空格的时候好方便解释成一个路径而不是命令参数.
      

  3.   

    > 用 CreateProcess() 吧
      

  4.   

    WinExec("\"C:\\Program Files\\Tencent\\RTXC\\Plugins\\menudemo\\SmartWord.exe\" ", ...)这样试试