X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d60e233244ce3af5192815ddb6ffe9e17b07e75e..ccdc11bbaf0310a474ad7b9d41413b31c3544356:/src/msw/utilsexc.cpp diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index fbeb00691f..8df728921e 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: msw/utilsexec.cpp +// Name: src/msw/utilsexc.cpp // Purpose: wxExecute implementation for MSW // Author: Julian Smart // Modified by: @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -33,9 +29,11 @@ #include "wx/app.h" #include "wx/intl.h" #include "wx/log.h" + #if wxUSE_STREAMS + #include "wx/stream.h" + #endif #endif -#include "wx/stream.h" #include "wx/process.h" #include "wx/apptrait.h" @@ -385,7 +383,7 @@ bool wxPipeInputStream::CanRead() const wxLogLastError(_T("PeekNamedPipe")); } - // don't try to continue reading from a pipe if an error occured or if + // don't try to continue reading from a pipe if an error occurred or if // it had been closed ::CloseHandle(m_hInput); @@ -417,7 +415,7 @@ size_t wxPipeInputStream::OnSysRead(void *buffer, size_t len) : wxSTREAM_READ_ERROR; } - // bytesRead is set to 0, as desired, if an error occured + // bytesRead is set to 0, as desired, if an error occurred return bytesRead; } @@ -487,16 +485,16 @@ size_t wxPipeOutputStream::OnSysWrite(const void *buffer, size_t len) #if wxUSE_IPC // connect to the given server via DDE and ask it to execute the command -static bool wxExecuteDDE(const wxString& ddeServer, - const wxString& ddeTopic, - const wxString& ddeCommand) +bool +wxExecuteDDE(const wxString& ddeServer, + const wxString& ddeTopic, + const wxString& ddeCommand) { bool ok wxDUMMY_INITIALIZE(false); wxDDEClient client; - wxConnectionBase *conn = client.MakeConnection(wxEmptyString, - ddeServer, - ddeTopic); + wxConnectionBase * + conn = client.MakeConnection(wxEmptyString, ddeServer, ddeTopic); if ( !conn ) { ok = false; @@ -710,23 +708,37 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) PROCESS_INFORMATION pi; DWORD dwFlags = CREATE_SUSPENDED; + #ifndef __WXWINCE__ dwFlags |= CREATE_DEFAULT_ERROR_MODE ; +#else + // we are assuming commands without spaces for now + wxString moduleName = command.BeforeFirst(wxT(' ')); + wxString arguments = command.AfterFirst(wxT(' ')); #endif bool ok = ::CreateProcess ( - NULL, // application name (use only cmd line) + // WinCE requires appname to be non null + // Win32 allows for null +#ifdef __WXWINCE__ (wxChar *) - command.c_str(), // full command line - NULL, // security attributes: defaults for both - NULL, // the process and its main thread - redirect, // inherit handles if we use pipes - dwFlags, // process creation flags - NULL, // environment (use the same) - NULL, // current directory (use the same) - &si, // startup info (unused here) - &pi // process info + moduleName.c_str(), // application name + (wxChar *) + arguments.c_str(), // arguments +#else + NULL, // application name (use only cmd line) + (wxChar *) + command.c_str(), // full command line +#endif + NULL, // security attributes: defaults for both + NULL, // the process and its main thread + redirect, // inherit handles if we use pipes + dwFlags, // process creation flags + NULL, // environment (use the same) + NULL, // current directory (use the same) + &si, // startup info (unused here) + &pi // process info ) != 0; #if wxUSE_STREAMS && !defined(__WXWINCE__) @@ -942,4 +954,3 @@ long wxExecute(wxChar **argv, int flags, wxProcess *handler) return wxExecute(command, flags, handler); } -