+// ---------------------------------------------------------------------------
+// Convert Windows to argc, argv style
+// ---------------------------------------------------------------------------
+
+wxChar **ConvertToStandardCommandArgs(const wxChar *p, int& argc)
+{
+ // break the command line in words
+ wxArrayString args;
+ if ( p )
+ {
+ args = wxCmdLineParser::ConvertStringToArgs(p);
+ }
+
+ // +1 here for the program name
+ argc = args.GetCount() + 1;
+
+ // and +1 here for the terminating NULL
+ wxChar **argv = new wxChar *[argc + 1];
+
+ argv[0] = new wxChar[MAX_PATH];
+ ::GetModuleFileName(wxhInstance, argv[0], MAX_PATH);
+
+ // copy all the other arguments to wxApp::argv[]
+ for ( int i = 1; i < argc; i++ )
+ {
+ argv[i] = wxStrdup(args[i - 1]);
+ }
+
+ // argv[] must be NULL-terminated
+ argv[argc] = NULL;
+
+ return argv;
+}
+
+#endif // wxUSE_GUI
+