Print Page | Close Window

Language XML crash

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=19711
Printed Date: 11 September 2025 at 12:50pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Language XML crash
Posted By: SMaton
Subject: Language XML crash
Date 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.



Replies:
Posted By: ddlittle
Date 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


Posted By: SMaton
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net