PATCHWISE.COM
The Creative Development Company
  Log in to check your private messagesLog in to check your private messages   Log inLog in 
  PatchWise Software Community ...................................................................................................................
FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile 

Using LcwLoadString in a non-MFC DLL

 
Post new topic   Reply to topic    PatchWise Software Community Forum Index -> LocWise Multilingual SDK Support
View previous topic :: View next topic  
Author Message
Alcatel_01



Joined: 10 Apr 2003
Posts: 7

PostPosted: Sep 19, 2003 1:48 pm    Post subject: Using LcwLoadString in a non-MFC DLL Reply with quote

Hi,

My application consists of an EXE using MFC, which links to a non-MFC DLL. The non-MFC DLL does not have its own resource file; all of its strings have been placed in the resource file of the EXE. I am having difficulty loading strings from the language file from within this non-MFC DLL.

When I call LcwLoadString (either the 2-parameter version or the 4-parameter version) from within the DLL, I am unable to load the string successfully and my application crashes. When I step into LcwLocalization.cpp using the debugger, the static variable m_pMainLangInfo is NULL, even though it had been initialized in my app's InitInstance function.

I am aware that one solution may be to create a separate resource file just for the DLL. However, I would prefer to not have to do this unless absolutely necessary. Please let me know if there is a simple way to get around this problem.

Thanks.
Back to top
View user's profile Send private message
Support
Site Admin


Joined: 03 Nov 2002
Posts: 118

PostPosted: Sep 19, 2003 5:52 pm    Post subject: Reply with quote

We've noticed this problem too, and it has been solved by adding new support function to LocWise Lib. Also, VC++ 7.1 (.NET 2003) is supported by the new version too. It will be released soon.
_________________
At Your Service
The PatchWise Software Support Team
Back to top
View user's profile Send private message Visit poster's website
Support
Site Admin


Joined: 03 Nov 2002
Posts: 118

PostPosted: Sep 22, 2003 12:43 am    Post subject: Reply with quote

The following two functions were added in 2.14:
PLANGINFO WINAPI LcwGetLangInfo(VOID);
BOOL WINAPI LcwInitLocalization(PLANGINFO LangInfo);

Call LcwGetLangInfo function from your app's InitInstance function after LcwInitLocalization finishing its initiation and pass the return value to the dll's initialization function

Code:
...
CString strLangPath = GetProfileString(_T("Directories"),
   _T("LanguageDir"), _T("Language"));
LcwInitLocalization(ID_LANGUAGE_FIRST, MAX_LANGUAGES);
LcwLoadLangs(strLangPath, _T("DllDemo???.lng"));
LcwSetDefaultLang();
InitMyLibDLL(LcwGetLangInfo());
...


the InitMyLibDll function here is a export function from your dll.

Call LcwInitLocalization function from your dll's InitMyLibDLL function beore any other LocWise function invoking from the dll.
Code:
...
// Exported DLL initialization
void InitMyLibDLL(PLANGINFO pLangInfo)
{
#ifdef LOCWISE_SUPPORT
   LcwInitLocalization(pLangInfo);
#endif
      
...
}
...


Now you can call other LocWise functions from your dll. Since it's not a real initalization, no cleaning up code is required in your dll.
_________________
At Your Service
The PatchWise Software Support Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    PatchWise Software Community Forum Index -> LocWise Multilingual SDK Support All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Powered by phpBB © 2001, 2002 phpBB Group
 
©  2002 Hanmen Software, Inc. All rights reserved.  | Terms of Use | Privacy Statement