Skip to main content
gamedev.net
🔒 Locked

GetSaveFileName problem

Started by Enselic 2 replies 200+ views
Original Post
Enselic
Enselic
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();
  
JBlum
JBlum
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.
Enselic
Enselic
It was the lack of ZeroMemory(&ofn, sizeof(OPENFILENAME)) who did it. It works when I zero the struct out.

Thanks for the reminder!
quasar3d
quasar3d


[edited by - Quasar3D on January 20, 2003 11:23:46 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.