Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Subclassing FileOpen and FileSave common dialog Collapse All
Subject Author Date
Ivan Shmakov Sep 13, 2007 - 3:07 AM


I’m trying to subclass FileOpen and FileSave commin dialog. But ProfUIS is crushed on CExtComboBox::DrawItem((LPDRAWITEMSTRUCT)lParam) when check MFC memory of ITEMS . Do you have any ideas?

It’s my code

class CProfUISFileDialog : public CExtNCW<CExtResizableDialog>
    CProfUISFileDialog(CWnd* pParent = NULL)
        :    m_pParent(pParent)
        m_bAutoSubclassChildControls = true;
        m_bShowResizingGripper = false;

    virtual ~CProfUISFileDialog() {}

virtual INT_PTR DoModal()
        // Test Opening
        OPENFILENAME ofn; // common dialog box structure
        TCHAR szFile[MAX_PATH]; // buffer for file name
        HANDLE hf; // file handle

        // Initialize OPENFILENAME
        ZeroMemory(&ofn, sizeof(ofn));
        ofn.lStructSize = sizeof(ofn);
        ofn.hwndOwner = m_pParent->m_hWnd;
        ofn.lpstrFile = szFile;
        // Set lpstrFile[0] to ’\0’ so that GetOpenFileName does not
        // use the contents of szFile to initialize itself.
        ofn.lpstrFile[0] = _T(’\0’);
        ofn.nMaxFile = sizeof(szFile);
        ofn.lpstrFilter = _T("All\0*.*\0Text\0*.TXT\0");
        ofn.nFilterIndex = 1;
        ofn.lpstrFileTitle = NULL;
        ofn.nMaxFileTitle = 0;
        ofn.lpstrInitialDir = NULL;

        if (GetOpenFileName(&ofn)==TRUE)

        return IDOK;
    CWnd*    m_pParent;


CProfUISFileDialog dlg(this);

Technical Support Sep 13, 2007 - 11:25 AM

Actually the combo box in the File Dialog is an extended version of the simple combo box control which provides support for image lists (CComboBoxEx). So it is incorrect to subclass it with the CExtComboBox class which is derived from the simple CComboBox. We spent a lot of time to create the Prof-UIS skinned extended combo box but failed. It simply ignores the WM_PAINT message and draws itself in some other way. If you find a way how to create a skinned version of CComboBoxEx then you will be able to use it in the File Dialog window.

If you are creating these dialogs from the scratch and encounter this error, please send us the source code so we can test it on our side and find out what is wrong.