Search code examples
visual-c++mfcafx

Issue enabling folder browse button on CMFCEditBrowseCtrl


Here's what the resource manager shows for this particular EditBrowseCtrl. You can see that the "Browse Mode" option is set to "Folder Browse". resource editor view

And here's what the actual dialog box looks like when I run the program(no browse button): no browse button

I've also tried to enable the folder browse button via the EnableFolderBrowseButton method, but the following just gives me a generic "encountered an improper argument" exception.

CMFCEditBrowseCtrl* pEdit;
pEdit = (CMFCEditBrowseCtrl*)GetDlgItem(IDC_MFCEDITBROWSE);
pEdit->EnableFolderBrowseButton();

As requested, here's the contents of the .rc file:

/////////////////////////////////////////////////////////////////////////////
//
// Dialog Info
//

IDD_PREFERENCES_PROPPAGE DLGINIT
BEGIN
    IDC_MFCLINK1, 0x37c, 175, 0
0x4d3c, 0x4346, 0x694c, 0x6b6e, 0x555f, 0x6c72, 0x733e, 0x7379, 0x616c, 
0x2e74, 0x6f63, 0x3c6d, 0x4d2f, 0x4346, 0x694c, 0x6b6e, 0x555f, 0x6c72, 
0x3c3e, 0x464d, 0x4c43, 0x6e69, 0x5f6b, 0x7255, 0x506c, 0x6572, 0x6966, 
0x3e78, 0x7468, 0x7074, 0x3a73, 0x2f2f, 0x2f3c, 0x464d, 0x4c43, 0x6e69, 
0x5f6b, 0x7255, 0x506c, 0x6572, 0x6966, 0x3e78, 0x4d3c, 0x4346, 0x694c, 
0x6b6e, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x4d2f, 0x4346, 0x694c, 
0x6b6e, 0x545f, 0x6f6f, 0x746c, 0x7069, 0x3c3e, 0x464d, 0x4c43, 0x6e69, 
0x5f6b, 0x7546, 0x6c6c, 0x6554, 0x7478, 0x6f54, 0x6c6f, 0x6974, 0x3e70, 
0x4146, 0x534c, 0x3c45, 0x4d2f, 0x4346, 0x694c, 0x6b6e, 0x465f, 0x6c75, 
0x546c, 0x7865, 0x5474, 0x6f6f, 0x746c, 0x7069, "\076" 
    IDC_MFCEDITBROWSE, 0x37c, 42, 0
0x4d3c, 0x4346, 0x6445, 0x7469, 0x7242, 0x776f, 0x6573, 0x4d5f, 0x646f, 
0x3e65, 0x3c32, 0x4d2f, 0x4346, 0x6445, 0x7469, 0x7242, 0x776f, 0x6573, 
0x4d5f, 0x646f, 0x3e65, 
    0
END

Any help is greatly appreciated.


Solution

  • I finally figured out that my issue was overriding OnInitDialog without calling the base class OnInitDialog (CDialogEx::OnInitDialog).