Im wondering, is there an easy way to pop a save as dialoge box or do I have to make it myself??!
Im wondering, is there an easy way to pop a save as dialoge box or do I have to make it myself??!
Founder and avid member of the Internationsl Typo Associateion
GetSaveFileName will launch the 'save' Common Dialog box.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
I followed that link and looked at the examples, but im having a slight problem. My program seems to freeze at the line where its supposed to get the dialog box. Here is what I have code wise:Originally Posted by Ken Fitlike
I dont get a save as window popping up at all. Any suggestions?Code:OPENFILENAME FileName; bool SaveBox = false; memset(&FileName, 0, sizeof(OPENFILENAME)); char FName[MAX_PATH] = ""; FileName.lStructSize = sizeof(OPENFILENAME); FileName.hwndOwner = GetActiveWindow(); FileName.lpstrCustomFilter = NULL; FileName.nFilterIndex = 0; FileName.lpstrFile = FName; FileName.nMaxFile = sizeof(FName); FileName.lpstrFileTitle = NULL; FileName.lpstrInitialDir = NULL; FileName.lpstrTitle = NULL; FileName.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST; //FileName.lpstrDefExt = DefaultExt; SaveBox = GetSaveFileName(&FileName); // IT HANGS HERE
Founder and avid member of the Internationsl Typo Associateion
I'm wondering about the GetActiveWindow() call. Could you just use the parent window handle directly? I can imagine a situation where the parent hwnd returned by GetActiveWindow might be a problem. Just guessing right now
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
and perhaps InitCommonCtrls() needs to be called?
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
>>I dont get a save as window popping up at all. Any suggestions?<<
Other than changing the type of your 'SaveBox' variable from bool to BOOL, the code looks fine to me. What compiler are you using?
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
I added this line when my window starts up. and Also I changed the HWND of the struct so it looks like this:Originally Posted by FillYourBrain
WindowHwnd is what I get when I create the window.Code:FileName.hwndOwner = WindowHwnd; //GetActiveWindow();
It Still Doesnt Work....
Founder and avid member of the Internationsl Typo Associateion
You don't need InitCommonCtrls to use the common dialog boxes.
Please post a minimal example that replicates the problem.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Oh i wish i could replicate the problem in a separate app. I wrote a little app that basically has the exact same code as the one posted in my first post, and it works completely fine. Do you suppose that maybe loading a certain library or something maybe be bugging out the dialogue code?Originally Posted by Ken Fitlike
Founder and avid member of the Internationsl Typo Associateion
Well, given that when you write a simple example it works, it should be relatively straightforward to isolate what differences in the larger example are giving rise to the problem. You might find some of the diagnostic error code(s) returned by CommDlgExtendedError will further help in the identification of the problem(s).
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Thats great that MS has these functions, but unfortunately my program hangs at GetSaveFileName() and therefore it doesnt even get to the next line after it, so therefore i cannot even call CommDlgExtendedError() afterwards.Originally Posted by Ken Fitlike
Founder and avid member of the Internationsl Typo Associateion