Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Language XML crash
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Language XML crash

 Post Reply Post Reply
Author
Message
SMaton View Drop Down
Groupie
Groupie


Joined: 04 May 2009
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote SMaton Quote  Post ReplyReply Direct Link To This Post Topic: Language XML crash
    Posted: 04 May 2012 at 4:26am
Hello everyone,

my application offers two languages: English and German. Upon application start the user can select one of those 2. To enable the language within Toolkit Pro, I do this:

CString toolkitResources = ProgrammVerzeichnis() + "\\daten\\";
if ( !IstLaendereinstellungEnglisch())
{
toolkitResources += "ToolkitPro.ResourceDe.xml";
}
else
{
toolkitResources += "ToolkitPro.ResourceEn.xml";
}
CXTPResourceManager::m_managerInstance->SetResourceFile(toolkitResources);
if ( !IstLaendereinstellungEnglisch())
CXTPResourceManager::m_managerInstance.GetData()->SetResourceLanguage(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN));
else
CXTPResourceManager::m_managerInstance.GetData()->SetResourceLanguage(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_UK));

When adding new items to a property grid, the application crashes in random location within the memory. I debugged it down to this lines within the toolkit:

CXTPPropertyGridItemBool::_Init(BOOL bValue)  (line 76):

  if (XTPResourceManager()->LoadString(&strTrueFalse, XTP_IDS_PROPERTYGRID_TRUEFALSE)
&& (strTrueFalse.Find(_T('\n')) != -1))

I've digged through the documentation but I couldn't find any further information about the language handling and the SetResourceFile...

I've also tried to load the language file like this:

CXTPResourceManager::m_managerInstance->SetResourceManager(new CXTPResourceManagerXML(toolkitResources));

If I don't call "SetResourceFile" or "SetResourceManager" it doesn't crash but shows the local settings...

Thanks for your help.
Back to Top
ddlittle View Drop Down
Senior Member
Senior Member


Joined: 19 February 2004
Location: United States
Status: Offline
Points: 132
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddlittle Quote  Post ReplyReply Direct Link To This Post Posted: 22 May 2012 at 12:16pm
My guess is that you are failing because you loaded the XML resources, rather than the .DLL.  I think your crash is in LoadString, because the resource handle isn't set properly.   
Unless strTrueFalse is undefined or returns NULL, I can't think of another reason.
 
mit freundlichen grüßen....
 
- David
Back to Top
SMaton View Drop Down
Groupie
Groupie


Joined: 04 May 2009
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote SMaton Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2012 at 2:39am
Thanks for the reply... I have changed the resource handling to DLLs and it doesn't crash anymore... Unfortunately it doesn't help me with the problem I tried to solve by using the language resources...

I wanted to datepicker to have the language of the application settings... and realized that Codejock relies on Win32 Common Dialogs for this (which always uses the system language; you cannot change this) :(

Thanks for your suggestion though
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.031 seconds.