My code looks like this:
Code: Select all
MainFrame* pMainFrame = new MainFrame( NULL );
wxArrayString arrFilePaths;
if ( this->argc > 1 )
{
for (int i = 1; i < this->argc; i++)
{
wxString strPath = this->argv[i];
arrFilePaths.Add( this->argv[i] );
}
pMainFrame->OpenMultiple( arrFilePaths );
}
and this works fine for .txt files. However, when trying to open another file with the extension .vb with my app it complained it couldn't find the files. It turned out it had inadvertently parsed the command line arguments:"C:\Program Files\MyApp\MyApp.exe" "%1"
C:\Document and Settings\User1\Desktop\Testfile.vb
had become three calls:
C:\Document
and
Settings\Users1\Desktop\Testfile.vb
al of which the system could not find.
How does one handle such case? Contatenate the argv arguments and then try to open until it works?