file dialog craps program with whitespaces in filenames

on vista it seems to work but on win7, if the file name has a whitespace in it, the program will crap out.


// Open file dialog box
string openfilename(char *filter = "All Files (*.*)\0*.*\0", HWND owner = NULL) {
OPENFILENAME ofn;
char fileName[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = owner;
ofn.lpstrFilter = filter;
ofn.lpstrFile = fileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "";
string fileNameStr;
if ( GetOpenFileName(&ofn) )
fileNameStr = fileName;
return fileNameStr;
}


//function to dump media file idv3 tags and file info using the DOS program ffmpeg
void setffmpeg(string fileNameStr){
string command = "ffmpeg -i ";
command+= fileNameStr; command += "> ffmpeg.txt 2>>&1";
system(command.c_str());
}


********************* ffmpeg output ***************

ffmpeg version N-43594-gf0896a6 Copyright (c) 2000-2012 the FFmpeg developers
built on Aug 15 2012 21:25:48 with gcc 4.7.1 (GCC)
configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 51. 69.100 / 51. 69.100
libavcodec 54. 52.100 / 54. 52.100
libavformat 54. 23.101 / 54. 23.101
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 9.100 / 3. 9.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
C:\Users\Brad\Documents\Visual: No such file or directory <<--NOTE where it breaks

************ complete code ****************

http://pastie.org/5666962
Topic archived. No new replies allowed.