Hi:
I got a quite weird problem--->
I was intializing the OPENFILENAME structure before calling
GetSaveFileName(&ofn).
Then called GetSaveFileName(&ofn) ,it was just fine, but when I changedCode:OPENFILENAME ofn; char szFileName[MAX_PATH] = "Untitled"; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwnd; ofn.lpstrFile = szFileName; //set default file name ofn.nMaxFile = MAX_PATH; //260 Max. characters ........ ofn.lpstrDefExt = "txt";//always add txt if no file extension added ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
program crashed when running it.Code:ofn.lpstrFile = szFileName; into: ofn.lpstrFile = "Untitled";
I don't know what is going on? I think they are doing the same thing. Anyone knows that? Thanks.



LinkBack URL
About LinkBacks



