]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/utilsexc.cpp
Include wx/stopwatch.h according to precompiled headers of wx/wx.h (with other minor...
[wxWidgets.git] / src / msw / utilsexc.cpp
index 4eed50125a3a1eb0cf2a2ea42e3fbb08f5057fa7..8df728921e05026034928c9cca4fb1ef836fa6f1 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        msw/utilsexec.cpp
+// Name:        src/msw/utilsexc.cpp
 // Purpose:     wxExecute implementation for MSW
 // Author:      Julian Smart
 // Modified by:
     #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"
@@ -483,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;
@@ -706,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 *)
+                 moduleName.c_str(), // application name
                  (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
+                 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__)
@@ -938,4 +954,3 @@ long wxExecute(wxChar **argv, int flags, wxProcess *handler)
 
     return wxExecute(command, flags, handler);
 }
-