如下面一段代码可以打开一个新窗口
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 );
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 );
随便吧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);
i++;
CString tephtm;
tephtm.Format("%s%d%s","d:\\a",i,".htm");//这样tephtm一定是CString形式,可是放在CreateProcess中的第二个参数,还是不正确呀
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)
NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)strPath.ReleaseBuffer();
会在已打开IE的窗口中打开新窗口,不合要求不知道为什么现在在这用地VC8 感觉没有VC6好用
在6下运行好好地,在8下就出错,在这也调试不起来
所以有些只能回家调试了