I have had this problem, after I call DoFileDialog() a second time, and I hover over a file, my whole program terminates with no warning or error message.
After searching this board and google I find out that this is a common problem, however, those people always fix their problems by fixing a buffer overflow problem. I'm smart enough to avoid that from the beggining. So please help! Why isn't this working more than once??
int DoFileDialog(HWND hwnd, BOOL bSave)
char *pszTempPath = new char[MAX_PATH];
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "Bitmap Files\0*.bmp\0All Files\0*.*\0\0";
ofn.lpstrFile = pszTempPath;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "*.bmp";
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
ofn.FlagsEx = OFN_EX_NOPLACESBAR;
if(bSave) bRet = GetSaveFileName(&ofn);
else bRet = GetOpenFileName(&ofn);
delete  pszTempPath;