Search code examples
c++winapicustomizationsavefiledialogofnhookproc

Customized Windows Save Dialog is no Longer Fancy -- Why?


In accordance with this question I am customizing a Win32 Save File dialog with a custom template description. Now I have a problem where the Save File dialog doesn't show the left-hand bar with my computer, recent places, etc. I can confirm that removing the custom template brings the left-hand sidebar back. What am I doing that warrants its removal? How do I get both?

Update: Here's some of the code I have:

info.hInstance = MyGetModuleInstanceRoutine();
info.lpfnHook = MyOFNHookProcRoutine;
info.lpTemplateName = MAKEINTRESOURCEW(myCustomResourceID);
info.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_NOREADONLYRETURN |
              OFN_ENABLESIZING | OFN_ENABLEHOOK | OFN_EXPLORER | OFN_ENABLETEMPLATE;

::GetSaveFileNameW(&info);

Notes:

  • MyOFNHookProcRoutine always returns 0.
  • I am aware of the extended flag OFN_EX_NOPLACESBAR and it is not set (i.e. FlagsEx is 0).

Solution

  • Adding to the answer from RED SOFT ADAIR-StefanWoe:

    Set WINVER and _WIN32_WINNT to a value >= 0x0500.

    The size of the OPENFILENAME structure grew for Windows 2000, and the extra space includes the FlagsEx member; apparently Windows assumes the flag OFN_EX_NOPLACESBAR if the structure is too small to contain it. Make sure the lStructSize member is set correctly too.