MFC Ribbon crashes in windows 2008

0

I have an application that uses the MFC Ribbon. It is developed in Visual Studio 2010. I am facing a strange issue. The app works fine in Windows 7 and windows 2008 R2. However it crashes in windows 2008 when it tries to load the ribbon from resource. The exact line is

ribbonBar->LoadFromResource(IDR_RIBBON1); //IDR_RIBBON1 is the resource id.

The stack trace is below

gui.exe!ATL::CComPtrBase<IXMLDOMDocument>::~CComPtrBase<IXMLDOMDocument>()  Line 162 + 0xa bytes    C++
gui.exe!ATL::CComPtr<IXMLDOMDocument>::~CComPtr<IXMLDOMDocument>()  + 0x11 bytes    C++
gui.exe!ATL::CComQIPtr<IXMLDOMDocument,&_GUID_2933bf81_7b36_11d2_b20e_00c04f983e60>::~CComQIPtr<IXMLDOMDocument,&_GUID_2933bf81_7b36_11d2_b20e_00c04f983e60>()  + 0x11 bytes    C++
gui.exe!ATL::CXMLNode<IXMLDOMDocument>::~CXMLNode<IXMLDOMDocument>()  Line 47 + 0xb bytes   C++
gui.exe!ATL::CXMLDocument::~CXMLDocument()  Line 269 + 0x13 bytes   C++
gui.exe!CXMLParserRoot::~CXMLParserRoot()  Line 423 + 0x43 bytes    C++
gui.exe!CMFCRibbonInfo::Read(unsigned char * lpBuffer=0x013acb14, unsigned int nSize=83851)  Line 703 + 0x15 bytes  C++
gui.exe!CMFCRibbonInfoLoader::LoadFromBuffer(unsigned char * lpBuffer=0x013acb14, unsigned int nSize=83851)  Line 112 + 0x1b bytes  C++
gui.exe!CMFCRibbonInfoLoader::Load(const char * lpszResID=0x000005d8, const char * lpszResType=0x0000001c, HINSTANCE__ * hInstance=0x00400000)  Line 85 + 0x1c bytes    C++
gui.exe!CMFCRibbonBar::LoadFromResource(const char * lpszXMLResID=0x000005d8, const char * lpszResType=0x0000001c, HINSTANCE__ * hInstance=0x00000000)  Line 740 + 0x17 bytes   C++
gui.exe!CMFCRibbonBar::LoadFromResource(unsigned int uiXMLResID=1496, const char * lpszResType=0x0000001c, HINSTANCE__ * hInstance=0x00000000)  Line 731    C++

Any suggestions, advice as to how to go about this issue is greatly appreciated. Do, ask if you need more information.

c++
visual-studio-2010
mfc
windows-server-2008
ribbon
asked on Stack Overflow Oct 30, 2012 by Eternal Learner • edited Nov 1, 2012 by Hans Passant

2 Answers

2

I know this answer is years late, but I just ran into your same problem while updating an old MFC application to support the Ribbon. What needed to be done in order for LoadResources to work correctly, was to call AfxOleInit() during InitInstance() in the App class. I do this before loading the MFC frame.

Hope this helps!

answered on Stack Overflow Aug 14, 2017 by rigo
0

Did you try to install redistributable package on deployed machine? It is possible that Windows (Server) 2008 R2 comes with Visual C++ 2010 Redistributable package and Windows Server 2008 not. Also take into account that if you updated Visual Studio to SP1 you should use redistributable package for SP1.

answered on Stack Overflow Nov 1, 2012 by Izzy

User contributions licensed under CC BY-SA 3.0