1

I display a CFileDialog:

CFileDialog dlgImport(TRUE,
    _T(".XSL"), _T(""), OFN_ALLOWMULTISELECT | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, strFilter, this);
ZeroMemory(pszFile, 32767 * sizeof(TCHAR));
dlgImport.m_ofn.lpstrFile = pszFile;
dlgImport.m_ofn.nMaxFile = 32767;
dlgImport.m_ofn.nFileOffset = 0;

if (dlgImport.DoModal() != IDOK)
{
    // User did not select any files so tidy up the memory
    delete[] pszFile;
    return;
}

It looks like this on Windows 10:

File Dialog - Filters

I might have asked this before, but I would prefer the filter box to be under the file name, just like in Visual Studio:

Visual Studio Filters

I am supporting:

  • WIndows 7
  • Windows 8
  • Windos 10

How can we acheive the same in MFC projects built with Visual Studio 2019?

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
  • The OpenFileDialog implementation on Windows 10 is buggy anyway. When there are multiple screens with different resolutions the controls on it can be clipped and various drawing artifacts can occur. It does look noobish work in ages old accessories like Notepad. Hard to make quality software by using it. – Öö Tiib May 02 '20 at 11:41
  • 2
    The first dialog is the standard "Open", the second dialog is the standard "Save", they look slightly different. You can't reposition new dialog controls, you have to let the API decide where to put them. – Barmak Shemirani May 02 '20 at 12:32
  • @ÖöTiib I have two screens with different resolutions and even different DPIs, and I can't reproduce any display of artifacts whatsoever. Could you elaborate? – Jabberwocky May 02 '20 at 13:37
  • @BarmakShemirani So are you suggesting i simply pass `TRUE` for the save parameter in the constructor? But I don't want it to say Save ... This is frustrating. – Andrew Truckle May 02 '20 at 14:11
  • @Jabberwocky I mean like that: https://imgur.com/a/zI3bh5v This is how Notepad's File Open dialog looks on other, 1920 x 1200 screen. My main screen is 3840 x 2160, there it looks OK, – Öö Tiib May 02 '20 at 14:33
  • @AndrewTruckle I didn't suggest that. I just pointed out the difference. – Barmak Shemirani May 02 '20 at 15:12
  • @BarmakShemirani Thanks for the clarification. But I am annoyed we can't use that layout for "Open". It looks plain ugly ... – Andrew Truckle May 02 '20 at 15:59
  • @ÖöTiib your picture is interesting, I don't have this light blue part with the big "folder icon" and the truncated text at all when I do File-Open in Notepad. I suppose you have some buggy shell extension installed. – Jabberwocky May 04 '20 at 13:10
  • 1
    @Jabberwocky I do avoid extensions. User of the dialog is supposed to be capable to turn it on/off by Organize -> Layout -> Details pane. You do not have that checkbox? – Öö Tiib May 04 '20 at 13:29
  • @ÖöTiib OK, got it. However no problem whatsoever on my computer. I have 2 screens, one of them at 100% the other at 150%, – Jabberwocky May 04 '20 at 13:33
  • Pity none of this actually fixes my problem of wanting the file type combo to be just liek the "save" fle type combo - nice n long under the filename edit box. :) – Andrew Truckle May 04 '20 at 14:09
  • @BarmakShemirani Could we use the alternative dialog and programatically change it to use the correct text for the button? – Andrew Truckle May 17 '20 at 04:25
  • 2
    No. Just leave it. Don't get obsessed with these minor issues. Your customers don't care about this either. Spend your time on improving other functionalities in your software. – Barmak Shemirani May 17 '20 at 13:56
  • @BarmakShemirani Understood and point taken sir. :) – Andrew Truckle May 17 '20 at 15:17

0 Answers0