Print Page | Close Window

Change language - SetResourceHandle

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=19936
Printed Date: 18 June 2025 at 11:21am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Change language - SetResourceHandle
Posted By: FSauer
Subject: Change language - SetResourceHandle
Date Posted: 10 July 2012 at 11:42am
Hi Oleg,

I want to change the language at run time.
I get an exception, if I use the followed code:

HMODULE hModule = ::LoadLibrary(
"c:\\Program Files\\Codejock Software\\MFC\\Xtreme ToolkitPro v15.1.3.0908\\Utils\\Translations\\ToolkitPro.ResourceDe.dll");
USHORT LangID = LANG_GERMAN;
XTPResourceManager()->SetResourceHandle(hModule);
::SetThreadLocale(MAKELCID(MAKELANGID(LangID,SUBLANG_DEFAULT), SORT_DEFAULT)); 

CXTPTaskDialog dlg;
dlg.SetWindowTitle("Test");
dlg.SetMainInstruction("Test...");
dlg.SetContent("Info");
dlg.SetCommonButtons(TDCBF_YES_BUTTON | TDCBF_NO_BUTTON);
dlg.EnableCancellation(TRUE);

// the followed line causes an exception in CXTPTaskDialogClient::CreateIcon by calling dlg.DoModal(), because LoadSysIcon(lpwzIcon, sizeIcon) returned NULL => ASSERT(hNewIcon != NULL);
dlg.SetMainIcon((LPCWSTR)TD_INFORMATION_ICON);

dlg.DoModal();

Why does this happened?

Best regards
Fabian



Replies:
Posted By: FSauer
Date Posted: 11 July 2012 at 8:23am
By clicking 'ignore' on exception the correct dialog (buttontext has german language) appear, but without info-icon!


Posted By: FSauer
Date Posted: 12 July 2012 at 10:09am
Hi, no idea?


Posted By: FSauer
Date Posted: 22 August 2012 at 4:52am
Hi,
I find the solution. If we set the Resourcehandle by calling SetResourceHandle, we have to call SetUseSysIcons(TRUE), too. Then, the Icon will loaded successfully!




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