【问题标题】:MFC SHELLLIST does not paintMFC SHELLLIST 不绘制
【发布时间】:2013-05-16 21:49:18
【问题描述】:

如果我使用 VS2010 创建一个新的 MFC GUI,创建一个对话框,在对话框中添加一个 MFC SHELLLIST 控件,对话框上的 DoModal,MFC SHELLLIST 填充了各种高级对象,然后可以导航通过。

但我有一个旧的 MFC GUI,最初是用 VS2005 创建的,导入到 VS2010 中,当我执行与上述完全相同的操作时,MFC SHELLLIST 为空。

有许多 MainFrm.cpp 操作是 VS2010 的样板,而不是 VS2005。可能其中一个或多个负责激活 MFC SHELLLIST。

有人知道是哪一个吗?

【问题讨论】:

    标签: mfc windows-shell


    【解决方案1】:

    我刚刚在 VS2012 中创建了一个新的 MFC 对话框应用程序,并添加了一个 shell 列表控件(工作正常)。与 SDI/MDI 应用程序相比,对话的 biolerplate 代码包含以下代码CMyWinApp::Initinstance

    // Create the shell manager, in case the dialog contains
    // any shell tree view or shell list view controls.
    CShellManager *pShellManager = new CShellManager;
    
    // Activate "Windows Native" visual manager for enabling themes in MFC controls
    CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
    

    应用程序关闭时CShellManager被删除

    // Delete the shell manager created above.
    if (pShellManager != NULL)
    {
        delete pShellManager;
    }
    

    所以,我认为至少您需要创建CShellManager,并且可能需要用于主题化的视觉管理器。

    【讨论】:

      【解决方案2】:

      问题是 MFC GUI 最初是在 VS2005 下开发的,然后导入到 VS2010 中。直到我用 VS2010 创建了一个全新的项目,然后有条不紊地从原始项目导入源代码后,MFC SHELLLIST 才能工作。必须 WinMerge 源如 MainFrm.cpp 和 MainFrm.h 以避免烦人的 MFC SHELLLIST 功能。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-11-27
        • 1970-01-01
        • 2023-03-19
        • 2013-01-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多