ribbon Posted by gardener on Wed 21 of Mar, 2012 00:19 GMT Anyone using this Multi-Language tool has issues when load Microsoft ribbon? In our application, the program fails to load ribbon resource. Can anyone give me some suggestion? Thanks.
Posted by nilss on Thu 22 of Mar, 2012 15:14 GMT Just downloaded the demo of the tool, and I've got exactly the same problem. I am using Visual Studio 2010, MFC. When switching the language, the resource for the ribbon can not be loaded any more.
Posted by Phil on Thu 22 of Mar, 2012 20:46 GMT I was able to reproduce this problem using the RibbonGadgets sample project (from the VC++ samples) and I have fixed it in version 5.0x.0016. The ribbon is defined in the .rc file with a ribbon resource, e.g. IDR_RIBBON RT_RIBBON_XML "res\\RibbonGadgets.mfcribbon-ms" or IDR_RIBBON 28 "res\\RibbonGadgets.mfcribbon-ms" The Add-In now copies this resource into the localized resources for the additional languages. However, the Add-In makes no attempt to localize the contents of the ribbon definition. Obviously, it would be much better if the Add-In scanned the contents of the ribbon definition file and was able to localize it. I will look into this, but don't guarantee I will implement it. Phil
Posted by gardener on Thu 22 of Mar, 2012 22:39 GMT I followed you advice and added the line. It works! Thank you very much!
Posted by nilss on Fri 23 of Mar, 2012 09:03 GMT Hello. After installing the new version 5.0x.0016, I get an Assertion after calling "m_wndRibbonbar.Create(this)", in "afxribbonbar.cpp, Line: 4272". I did not yet understand the structure of the projects for the "satellite dlls" - can you perhaps tell me which resource files I can manually edit to solve the issue? Thanks a lot for your support. Nils
Posted by gardener on Fri 23 of Mar, 2012 17:51 GMT Nils, you need to copy the line like IDR_RIBBON RT_RIBBON_XML "res\RibbonGadgets.mfcribbon-ms" from your original rc file to the new rc file specified with the language you added and you should be ok. Good luck!
Posted by Phil on Sat 24 of Mar, 2012 16:29 GMT Normally, the Add-In uses a single .rc file for all languages. There is an option "Use separate .rc file for each language", but by default it should not be selected. The file is separated into blocks, something like the one below. ///////////////////////////////////////////////////////////////////////////// // French resources (Added by Multi-Language Add-In) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) #ifdef _WIN32 LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL #endif //_WIN32 // Resource defintions #endif // French resources ///////////////////////////////////////////////////////////////////////////// This is more or less the same as the code which Visual Studio generates. The Add-In adds preprocessor definitions for the resource compiler to select the appropriate language resources, as shown below: There is a separate visual studio project for each satellite dll, with preprocessor definitions to select the desired language, but always using the same .rc file. The output directory is set up to generate the satellite dll in a subdirectory of the output directory of the main project, using the language tag as the directory name. This is the structure which Microsoft uses for (.NET) Windows Forms projects. I have chosen to use it for MFC projects. I have also chosen to use the IETF language tags, rather than the 3 letter name which microsoft seems to prefer for MFC projects. Somewhere in your project, you will require code to load the satellite dll with the function LoadLibrary() and select it with the function AfxSetResourceHandle. The Add-In has a feature to add a select language dialog to your project, which handles this fairly painlessly. (Recently I found that it put the resource definition in the wrong place in the .rc file. I will look into this soon.) I hope that that gives you an overview of the satellite Dlls. I cannot figure out your specific problem with an assertion error in afxribbonbar.cpp. The line number does not correspond to an assertion in the version which I have of this file. (Maybe you could post the exact code where it happens.) I have been testing with the MFC sample projects from Microsoft. In these projects m_wndRibbonbar.Create(this) is called before loading the ribbon resource. If that is the case in your project, then I can't see any connection to the ribbon resource. Phil