Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8684893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:25:17+00:00 2026-06-12T22:25:17+00:00

I have an MFC-based app that uses the Office 2007 ribbon interface. MFC is

  • 0

I have an MFC-based app that uses the Office 2007 ribbon interface. MFC is statically linked.

I’m trying to add Japanese localization. I have the localized resources in a separate DLL. I’m loading the resource DLL at the beginning of InitInstance:

VERIFY(hRes = LoadLibrary(_T("JapaneseLang.dll")));
if(hRes)
    AfxSetResourceHandle(hRes);

This causes an assert failure at CMFCVisualManagerOffice2007::OnUpdateSystemColors

#if !defined _AFXDLL
        TRACE(_T("\r\nImportant: to enable the Office 2007 look in static link,\r\n"));
        TRACE(_T("include afxribbon.rc from the RC file in your project.\r\n\r\n"));
        ASSERT(FALSE);
#endif

But I do have afxribbon.rc included in the rc files of both the DLL and the EXE.


I also found a similar question asked at tech-archive.net and a possible solution is outlined there

Now i find the error location. this shoule be a bug of new mfc
version.

In the CMFCVisualManagerOffice2007 ,when the style is changing , the
function SetStyle of CMFCVisualManagerOffice2007 auto call FreeLibrary
to free the dll, so the error happend.

Now i derived a class from CMFCVisualManagerOffice2007 and add a
static function to set the member variable m_bAutoFreeRes , by doing
this the application can run correctly; see bellow.

class CMFCVisualExtManagerOffice2007 : public
CMFCVisualManagerOffice2007 {
DECLARE_DYNCREATE(CMFCVisualExtManagerOffice2007) public:
CMFCVisualExtManagerOffice2007(); virtual
~CMFCVisualExtManagerOffice2007();

static void SetAutoFreeRes(BOOL bAutoFree = FALSE) { m_bAutoFreeRes =
bAutoFree; } };


But I have trouble understanding what exactly causes the problem, and how this solution works. Also I’m not sure if it is a correct solution. Does anyone know what exactly causes this problem, and how the solution works?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:25:19+00:00Added an answer on June 12, 2026 at 10:25 pm

    I figured out how the solution works. I need to set m_bAutoFreeRes to false after each call to CMFCVisualManagerOffice2007::SetStyle.

    class CMFCVisualExtManagerOffice2007 : public CMFCVisualManagerOffice2007
    {
        DECLARE_DYNCREATE(CMFCVisualExtManagerOffice2007)
    public:
        CMFCVisualExtManagerOffice2007();
        virtual ~CMFCVisualExtManagerOffice2007();
    
        static void SetAutoFreeRes(BOOL bAutoFree = FALSE)
        {
            m_bAutoFreeRes = bAutoFree;
        }
    };
    

    and then when switching between the themes

        switch (m_nAppLook)
        {
        case ID_VIEW_APPLOOK_OFF_2007_BLUE:
            CMFCVisualManagerOffice2007::SetStyle (CMFCVisualManagerOffice2007::Office2007_LunaBlue);
            CMFCVisualExtManagerOffice2007::SetAutoFreeRes(FALSE);
            break;
    
        case ID_VIEW_APPLOOK_OFF_2007_BLACK:
            CMFCVisualManagerOffice2007::SetStyle (CMFCVisualManagerOffice2007::Office2007_ObsidianBlack);
            CMFCVisualExtManagerOffice2007::SetAutoFreeRes(FALSE);
            break;
    
        case ID_VIEW_APPLOOK_OFF_2007_SILVER:
            CMFCVisualManagerOffice2007::SetStyle (CMFCVisualManagerOffice2007::Office2007_Silver);
            CMFCVisualExtManagerOffice2007::SetAutoFreeRes(FALSE);
            break;
    
        case ID_VIEW_APPLOOK_OFF_2007_AQUA:
            CMFCVisualManagerOffice2007::SetStyle (CMFCVisualManagerOffice2007::Office2007_Aqua);
            CMFCVisualExtManagerOffice2007::SetAutoFreeRes(FALSE);
            break;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a test case that crashes our big MFC-based app with a heap
I have a MFC dialog based project,Now I want to add database with that
I have an MFC app which is wizard based. The App asks a user
I have implemented tool tips seemingly successfully in an app which is MFC based
I have a dialog-based MFC C++ app. My dialog displays a number of pages
I have a MFC dialog based application. The main dialog contain a child dialog
I have a MFC dialog based application in which I use ::system() function to
I have a MFC app written in Visual Studio 6 which I am adding
I have an MFC extension DLL that I've written. It contains derived classes of
I have a MFC application that launches a IWebBrowser2 window. On users computers where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.