Localizing resources problem |
Post Reply |
Author | |
GRLEX
Groupie Joined: 17 February 2009 Location: Ukraine Status: Offline Points: 27 |
Post Options
Thanks(0)
Posted: 04 March 2011 at 11:53am |
Hi everyone. I have an MFC application and i need to localize resources. I merge all resources into small project wich made .dll file from my resources. I use Visual Studio 2008 and CodeJock 15.0.1.
I put into my dll project .rc2 file In this file i include CodeJock resources: #ifdef APSTUDIO_INVOKED #error this file is not editable by Microsoft Visual C++ #endif //APSTUDIO_INVOKED #include <XTToolkitPro.rc> #include <SkinFrameWork\Styles\Office2007\Office2007.rc> #include <Styles\Office2007\Office2007.rc> When I check my dll - i have found CodeJock resources in it. For localize it i put something like #define _XTP_RESOURCE_LANGUAGE ru before #include <XTToolkitPro.rc> it works. When I load my dll in main project i redirect resource handle to it ::AfxSetResourceHandle(m_hResDLL); and CodeJock resource manager too XTPResourceManager()->SetResourceHandle(m_hResDLL); But My app still crash, when i create main frame. Crash appears when i set theme to ribbon GetCommandBars()->SetTheme(xtpThemeRibbon); And there is assert message "Error Locating Office2007 Resources." "Make sure you have included the resources to your project's .rc2 file. For example to provide support for Office 2007 Black Visual Style by adding the following line to your project .rc2 file: #include <Styles/Office2007Black/Office2007Black.rc> file." but in new 15.0.1 release Office2007Black.rc Office2007Blue.rc and others as i know was replaced by Office2007.rc Pls help me with any ideas (I have read topic http://forum.codejock.com/forum_posts.asp?TID=17173&KW=Error+Locating&title=localizing-resources-breaks-codejock it's already losed. If you resolve thouse problem pls answer me how?) Sorry for my english. Thanks. |
|
Mk1
Groupie Joined: 01 March 2011 Status: Offline Points: 10 |
Post Options
Thanks(0)
|
How about single stepping into the code and figuring out what exactly it's trying to load that it can't find? Then you can look at the DLL and see if that's in the resource DLL or not? Basically set a break-point at "SetTheme" then step in and see where it fails.
Sounds like the basic issue is not including enough RC files in the DLL.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Please add #include <Styles\Office2007\Office2007.rc> in your main exe. Its shared resources so you don't need add it to all resource files.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
GRLEX
Groupie Joined: 17 February 2009 Location: Ukraine Status: Offline Points: 27 |
Post Options
Thanks(0)
|
Thanks. It's help.
|
|
GRLEX
Groupie Joined: 17 February 2009 Location: Ukraine Status: Offline Points: 27 |
Post Options
Thanks(0)
|
Hi again. I have one question again:
Here is my .rc2 file, wich i connect into my .rc file in Dll project // // Russian_RU.RC2 - resources Microsoft Visual C++ does not edit directly // #ifdef APSTUDIO_INVOKED #error this file is not editable by Microsoft Visual C++ #endif //APSTUDIO_INVOKED #define _XTP_RESOURCE_LANGUAGE ru #include <XTToolkitPro.rc> Yesterday we have download a CodeJock update 15.0.2 and for now i have error when i rebuild my Dll. Error: C:\Program Files (x86)\Codejock Software\MFC\Xtreme ToolkitPro v15.0.2\Source\Calendar/res/Resource-Neutral.rc(28) : error RC2135 : file not found: 0x00 but this file exist. As i can see in CodeJock .Rc file language for calendar changed to NEUTRAL if not define _XTP_NO_BINARY_RESOURCES I try to define this, but it was not helpfull. New error occured - not find resouce_ru.rc but it also exist. What i need to do to compile my dll with different language support of CodeJock resource? Thanks for replying.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
I added to our sample's rc2 file #define _XTP_RESOURCE_LANGUAGE ru #include <XTToolkitPro.rc> And don't see any problems. Please try.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
GRLEX
Groupie Joined: 17 February 2009 Location: Ukraine Status: Offline Points: 27 |
Post Options
Thanks(0)
|
Thank you. All works fine. I have found what was wrong in my code. Trouble was in my .rc file. At the end of .rc file there is include .rc2 file and language definitions which was wrong. There is right code #define _AFX_NO_SPLITTER_RESOURCES #define _AFX_NO_OLE_RESOURCES #define _AFX_NO_TRACKER_RESOURCES #define _AFX_NO_PROPERTY_RESOURCES #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) #ifdef _WIN32 LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT #pragma code_page(1251) #endif //_WIN32 #include "Russian_RU.rc2" // non-Microsoft Visual C++ edited resources #include "afxres.rc" // Standard components #include "afxolecl.rc" // OLE container resources #endif Bold code - is right definition for russian language and need to change depend from need language Thank you.
|
|
GRLEX
Groupie Joined: 17 February 2009 Location: Ukraine Status: Offline Points: 27 |
Post Options
Thanks(0)
|
Hi again :) I have one more question: When i change language in my App i load new .dll with resources. This dll i pass to resource manager
XTPResourceManager()->SetResourceFile(sSomeNameDll); (as i saw there is no difference between this call and call XTPResourceManager()->SetResourceHandle(hSomeLoadedDll) ) and then if i load new resource in OnCreate() method of any modal dialog Something like this AfxSetResourceHandle(XTPResourceManager()->GetResourceHandle()); then modal dialogs use new loaded resource. But for set new resource for example for ribbon bar i need to get each control from ribbon and reload strings manually. Is there way to refresh ribbon automatically? i try something like this: GetCommandBars()->UpdateCommandBars(); or GetCommandBars()->RedrawCommandBars(); or GetCommandBars()->InvalidateCommandBars(); but after i do this - i can't see ribbon at all :) but if i load manually strings - all works fine. Thank you.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
There a lot of places where strings stored internally in some CString. Most easy way is to ask user restart application after langauge changed.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |