--- cedtorig/cedtViewHndrMisc.cpp Wed Nov 10 09:52:32 2004 +++ cedtViewHndrMisc.cpp Thu Jan 4 14:26:43 2007 @@ -149,8 +149,39 @@ void CCedtView::OnToolMsDosShell() { - CString szShellPath = GetMsDosShellPath(); - WinExec( szShellPath, SW_SHOWNORMAL ); + // CHANGE by LARSP Jan 2007 + // + // Dos shell now opens in file dir. + // CreateProcess api is used instead of WinExec to accomplish this + // + + // Get current directory + CCedtDoc * pDoc = (CCedtDoc *)GetDocument(); + CString szFile = pDoc->GetPathName(); + LPCSTR pCurDir; + + if (szFile.GetLength() > 0) { + szFile = GetFileDirectory(szFile); + pCurDir = szFile; + } + else { + pCurDir = NULL; + } + + STARTUPINFO sui; + PROCESS_INFORMATION pi; + + // initialize SUI + memset(&sui, 0, sizeof(STARTUPINFO)); + sui.cb = sizeof(STARTUPINFO); + + sui.wShowWindow = SW_SHOWNORMAL; + sui.dwFlags = STARTF_USESHOWWINDOW; + + // Create the command line process + CreateProcess(NULL, "cmd", NULL, NULL, TRUE, + NORMAL_PRIORITY_CLASS, NULL, pCurDir, &sui, &pi); + } void CCedtView::OnToolViewInBrowser()