1

Windows OpenFile Dialog do not display initial file name correctly: enter image description here

The file name is scrolled to the left as it would be too long. If I choose the same file by a double-click, then its name is shown correctly.

The MFC's CFileDialog is used to create the OpenFile Dialog:

CFileDialog fileDialog(TRUE, nullptr, 
                       _T("GutenTagScript.vbs"), OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST, 
                       _T("VBS Files|*.vbs||"), this, 0);

The problem occurs only in OpenFile Dialog not in SaveFile Dialog.

Viktor Be
  • 658
  • 1
  • 11
  • 25
  • 3
    Appears to be a [known issue](https://stackoverflow.com/q/24525606/1889329). – IInspectable Jun 15 '20 at 17:20
  • @IInspectable Ok, so it is some general Windows OS problem... I face the issue using C++ and you posted a link to a C# issue. – Viktor Be Jun 15 '20 at 17:27
  • The C# code calls the same Shell functions. The only difference is in the interface, not the code that eventually runs. – IInspectable Jun 15 '20 at 17:29
  • 2
    It's actually difficult to determine where the problem is... See this: https://stackoverflow.com/questions/60182612/default-filename-appears-truncated-in-windows-ifiledialog Since you're on C++, you can try to use IFileDialog directly see if the problem persist. I personally have no problem using the sample code (so as guys in the comment). – Simon Mourier Jun 15 '20 at 17:38
  • Shouldnt your filter string end `||`. And try using a buffer for the filename by modifying the `OFN` structure before it is displayed. – Andrew Truckle Jun 15 '20 at 22:40
  • 3
    I can reproduce this issue using Win32 C++ application (using `IFileOpenDialog`). I'll submit an issue internally. – Rita Han Jun 16 '20 at 02:46

0 Answers0