如下面一段代码可以打开一个新窗口
ShellExecute(   this->m_hWnd,   "open",   "C:\\Program   Files\\Internet Explorer\\iexplore.exe", "c:\\a.htm",   0,   SW_SHOWMAXIMIZED   );现在问题是我需要打开地窗口是不确定
比如上面地改写成下面形式就会报错,谢谢
int i=0;
i++;
CString tephtm="d:\\a"+i+".htm";
ShellExecute( this->m_hWnd,  "open", "C:\\Program   Files\\Internet Explorer\\iexplore.exe", tephtm,  0,  SW_SHOWMAXIMIZED );

解决方案 »

  1.   

    真郁闷,,,,明明是CreateProcess函数问题,发帖子居然发错了:(
    随便吧int i=0;
    i++;
    CString tephtm="d:\\a"+i+".htm";PROCESS_INFORMATION pi;
    STARTUPINFO si;
    ZeroMemory(&si, sizeof(si));
    si.cb = sizeof(STARTUPINFO);
    if(CreateProcess("c:\\Program files\\Internet Explorer\\IExplore.exe", 
    "open "+tephtm,
    NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
    {
    // 等待这个进程结束
    WaitForSingleObject(pi.hProcess, INFINITE);
    CloseHandle(pi.hThread);
    CloseHandle(pi.hProcess);
    }
    else
    MessageBox(Handle, "无法启动进程!", "Error", MB_OK);
      

  2.   

    CString tephtm="d:\\a"+i+".htm";//这个行吗?把整数和字符串相加
      

  3.   

    呵呵,改一下,即使我使用下面形式也不正确呀int i=0;
    i++;
    CString tephtm;
    tephtm.Format("%s%d%s","d:\\a",i,".htm");//这样tephtm一定是CString形式,可是放在CreateProcess中的第二个参数,还是不正确呀
      

  4.   

    CString tephtm;
    tephtm.Format("c:\\Program files\\Internet Explorer\\IExplore.exe %s%d%s","d:\\a",i,".htm");CreateProcess(NULL,tephtm,
    NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)
      

  5.   

    CString strPath;strPath.Format("c:\\Program files\\Internet Explorer\\IExplore.exe %s%d%s","d:\\a",i,".htm");CreateProcess(NULL,strPath.GetBuffer(strPath.GetLength()),
    NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)strPath.ReleaseBuffer();
      

  6.   

    ShellExecute(NULL, NULL, _T("iexplore"), _T(网址), "",SW_MAXIMIZE);
      

  7.   

    楼上地,你ShellExecute不能打开一个新窗口啊
    会在已打开IE的窗口中打开新窗口,不合要求不知道为什么现在在这用地VC8 感觉没有VC6好用
    在6下运行好好地,在8下就出错,在这也调试不起来
    所以有些只能回家调试了