0

I have a requirement in my app where I need to set the File-name and extension programmatically with the Common save-as File dialog. But seems the save-as-File-type is not considered until changing the save-as-type on the dialog by manually. It takes the current type of opened file by default even though the save-as-type on dialog is different, and ask for overwriting the existing file. I have tried with parameters with OPENFILENAME struct, but couldn't resolve it.Any help is appreciated on this issue.

njohn
  • 81
  • 6

1 Answers1

1

Leave the lpstrDefExt field empty.

If this field is filled, the Default will be used.

xMRi
  • 14,982
  • 3
  • 26
  • 59
  • That also means you have to make sure there is no file extension specified in the value of the filename field, or else it will be used instead of the default. It is also not uncommon to use the [`CDN_TYPECHANGE`](http://msdn.microsoft.com/en-us/library/windows/desktop/ms646868.aspx) event to manually update the value of the filename field with the selected file extension. – Remy Lebeau Dec 04 '13 at 20:38