• Advertisement

Archived

This topic is now archived and is closed to further replies.

GetSaveFileName problem

This topic is 5479 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I debug and check the value in temp , it equals zero which means no error. But I don''t see a savefiledialog anywhere! Anyone know whats wrong?:
  
	OPENFILENAME ofn;

	ofn.lStructSize = sizeof( OPENFILENAME );//OPENFILENAME_SIZE_VERSION_400;

	ofn.hwndOwner = g_hWnd;
	ofn.Flags = OFN_OVERWRITEPROMPT;
	ofn.lpstrDefExt = "txt";

	GetSaveFileName( &ofn );
	DWORD temp = GetLastError();
  

Share this post


Link to post
Share on other sites
Advertisement
I tried your code out in a framework of mine and it does call the save dialog box. Make sure you are calling the function at some point and that your g_hWnd is properly initialized. Also it is a good idea to "ZeroMemory(&ofn, sizeof(OPENFILENAME));" after declaring your ofn variable, just to be safe.

Share this post


Link to post
Share on other sites
It was the lack of ZeroMemory(&ofn, sizeof(OPENFILENAME)) who did it. It works when I zero the struct out.

Thanks for the reminder!

Share this post


Link to post
Share on other sites

  • Advertisement