Add wxEXEC_HIDE_CONSOLE flag allowing to unconditionally do it under MSW.
Also renamed wxEXEC_NOHIDE to wxEXEC_SHOW_CONSOLE for symmetry (keeping the old name for compatibility, of course). Extend exec sample to allow easily testing the different flags and adding more of them later. See #13676. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69964 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -755,15 +755,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
|
||||
@@ -788,6 +779,17 @@ 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;
|
||||
|
||||
|
Reference in New Issue
Block a user