X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/906c935a80b10d53cecf57f71ab5f3f4f1d529ec..364f3b070071ee73e417a3770342d779774288e8:/src/msw/utilsexc.cpp diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 2887ce5340..734ca45d11 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -48,10 +48,8 @@ #if !defined(__GNUWIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) #include -#ifndef __MWERKS__ #include #endif -#endif #if defined(__GNUWIN32__) #include @@ -82,9 +80,7 @@ #include "wx/dde.h" // for WX_DDE hack in wxExecute #endif // wxUSE_IPC -// implemented in utils.cpp -extern "C" WXDLLIMPEXP_BASE HWND -wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc); +#include "wx/msw/private/hiddenwin.h" // ---------------------------------------------------------------------------- // constants @@ -757,15 +753,6 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, si.hStdOutput = pipeOut[wxPipe::Write]; si.hStdError = pipeErr[wxPipe::Write]; - // when the std IO is redirected, we don't show the (console) process - // window by default, but this can be overridden by the caller by - // specifying wxEXEC_NOHIDE flag - if ( !(flags & wxEXEC_NOHIDE) ) - { - si.dwFlags |= STARTF_USESHOWWINDOW; - si.wShowWindow = SW_HIDE; - } - // we must duplicate the handle to the write side of stdin pipe to make // it non inheritable: indeed, we must close the writing end of pipeIn // before launching the child process as otherwise this handle will be @@ -790,10 +777,25 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, } #endif // wxUSE_STREAMS + // The default logic for showing the console is to show it only if the IO + // is not redirected however wxEXEC_{SHOW,HIDE}_CONSOLE flags can be + // explicitly specified to change it. + if ( (flags & wxEXEC_HIDE_CONSOLE) || + (redirect && !(flags & wxEXEC_SHOW_CONSOLE)) ) + { + si.dwFlags |= STARTF_USESHOWWINDOW; + si.wShowWindow = SW_HIDE; + } + + PROCESS_INFORMATION pi; DWORD dwFlags = CREATE_SUSPENDED; #ifndef __WXWINCE__ + if ( (flags & wxEXEC_MAKE_GROUP_LEADER) && + (wxGetOsVersion() == wxOS_WINDOWS_NT) ) + dwFlags |= CREATE_NEW_PROCESS_GROUP; + dwFlags |= CREATE_DEFAULT_ERROR_MODE ; #else // we are assuming commands without spaces for now