We are using the XML files. But, I do fall back on the DLLs if the XML files cannot be loaded. For the DLL case, I think the issue is that CJ doesn't play the AFX_MANAGE_STATE module state game. Nor does it get the active MFC resource handle, set its own, get the resource needed, and then reset the original one. I see the CJ resource manager has methods that appear to be written to do just that but they are not called when, for example, CJ needs to get the "Auto hide" string for a docking pane. Instead, CodeJock gets its own module handle when retrieving a resource and looks for the resource first in that module and then if not found, it calls CString::LoadString. That call relies on the MFC extension module paradigm to find a resource.
When we build our ribbon, we set our resource handle and create controls. When we call SetID on a control, the CJ code goes to the resource manager and asks for the string. So, when there is a clash of IDs, CJ gets the string from its resource file instead of ours.
I found a post I made a number of years ago on the CJ forums and what I did then was to remove all the entries in the CJ HTM files. This time, I wrote two subclasses of the CJ XML res manager and the DLL based res manager. At first I tried to call CString::LoadString first in the DLL based subclass and if the resource was not found, I called the base class. But, when running with a lang like Russian, CJ strings like "Auto hide" are found in the toolkit pro DLL as it is in the MFC extension module chain. And, it is English, not Russian. So, I added code that first checks the ID against "known" CJ resources defined in various resource.h files (command bars, docking panes, tab manager ...). If one of those IDs comes along, I go to the base class method to get the resource. Otherwise, I call the CString method.
We have always avoided IDs < 10000 as that is where we find most of the CJ resource IDs. It is these other IDs that got added that are causing issues. I didn't try to track down where, for example, 25062 came from (Icon in English) so it might be a MFC ID.
I think all the issues would have been more easily avoided for us if when CJ needs something like a tab manager resource or a docking pane resource like "Auto hide", it had just pushed the CJ localized resource module into the AFX res handle (AfxSetResourceHandle) and called CString::LoadString. I could avoid my big "if" statement in that case. When registering the extension module, CJ should also be registering the localized resource handle or not adding the Toolkit pro DLL as a resource as it is always English.
We happen to support any language on any OS by examining the system locale. We also let a user set an option for "English" even when the system is set to another language. We load our localized resource and do not mix both English and another language. Works well for us but we do have to use the AFX module macro or call AfxGetResourceHandle, AfxSetResourceHandle, get the resource and then AfxSetResourceHandle (to restore the original one). This also works well with add-ins written in Visual Studio c++ as we avoid loading our resources when an add-in want's one of its own. The add-in has to use the AFX manage state macro too, of course.
|