- wxStringList args;
-
- wxString cmdLine(lpCmdLine);
- int count = 0;
-
- // Get application name
- wxChar name[260]; // 260 is MAX_PATH value from windef.h
- ::GetModuleFileName(wxhInstance, name, WXSIZEOF(name));
-
- args.Add(name);
- count++;
-
- wxStrcpy(name, wxFileNameFromPath(name));
- wxStripExtension(name);
- wxTheApp->SetAppName(name);
-
- // Break up string
- // Treat strings enclosed in double-quotes as single arguments
- int i = 0;
- int len = cmdLine.Length();
- while (i < len)
- {
- // Skip whitespace
- while ((i < len) && wxIsspace(cmdLine.GetChar(i)))
- i ++;
+ // break the command line in words
+ wxArrayString args =
+ wxCmdLineParser::ConvertStringToArgs(wxConvertMB2WX(lpCmdLine));