Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Localizing resources problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Localizing resources problem

 Post Reply Post Reply
Author
Message
GRLEX View Drop Down
Groupie
Groupie
Avatar

Joined: 17 February 2009
Location: Ukraine
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote GRLEX Quote  Post ReplyReply Direct Link To This Post Topic: Localizing resources problem
    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

it's already losed. If you resolve thouse problem pls answer me how?)

Sorry for my english.
Thanks.


Back to Top
Mk1 View Drop Down
Groupie
Groupie


Joined: 01 March 2011
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mk1 Quote  Post ReplyReply Direct Link To This Post Posted: 05 March 2011 at 8:39am
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. 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 07 March 2011 at 4:11am
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
Back to Top
GRLEX View Drop Down
Groupie
Groupie
Avatar

Joined: 17 February 2009
Location: Ukraine
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote GRLEX Quote  Post ReplyReply Direct Link To This Post Posted: 11 March 2011 at 5:26am
Thanks. It's help.
Back to Top
GRLEX View Drop Down
Groupie
Groupie
Avatar

Joined: 17 February 2009
Location: Ukraine
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote GRLEX Quote  Post ReplyReply Direct Link To This Post Posted: 11 March 2011 at 5:36am
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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 11 March 2011 at 12:44pm
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
Back to Top
GRLEX View Drop Down
Groupie
Groupie
Avatar

Joined: 17 February 2009
Location: Ukraine
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote GRLEX Quote  Post ReplyReply Direct Link To This Post Posted: 16 March 2011 at 9:46am
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.
Back to Top
GRLEX View Drop Down
Groupie
Groupie
Avatar

Joined: 17 February 2009
Location: Ukraine
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote GRLEX Quote  Post ReplyReply Direct Link To This Post Posted: 17 March 2011 at 6:21am
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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 17 March 2011 at 8:29am
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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.