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 

LcwLoadString always returns 0

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





PostPosted: Feb 17, 2005 5:52 am    Post subject: LcwLoadString always returns 0 Reply with quote

I experience problems when trying to load a string from a lng file in my MFC application.
The initialisation is done... everything seems to work fine, but the return value of LcwLoadString is always 0.
Code:

bool CAbc::LoadLanguagePackString(UINT nID,CString &str)
{
#ifdef LWLANGPACK
   int ret;

   if(LcwGetCurrentLangNode()==NULL)   
   {
      TRACE0("No language pack set, using default resource!\n");
      return false;
   }
   ret=LcwGetLangCount();   
   PLANGNODE tmp=LcwFindLangIndex(0); // returns correct lng
   PLANGNODE tmpCurrent=LcwGetCurrentLangNode(); // returns correct lng
   ret=LcwLoadString(nID,str);
   ret=LcwLoadString(AfxGetInstanceHandle(),nID,str.GetBuffer(1024),1024);  // second one only for testing
   str.ReleaseBuffer();
   if(ret==0)
   {   
      return false;
   }
   return true;
#else
   return false;
#endif


Any suggestions?
Back to top
Support
Site Admin


Joined: 03 Nov 2002
Posts: 118

PostPosted: Feb 17, 2005 9:09 am    Post subject: Reply with quote

Seems LocWise could not find the string resource in the application’s resources. If the string resource cannot be found, LocWise will not load the string from the language pack.
_________________
At Your Service
The PatchWise Software Support Team
Back to top
View user's profile Send private message Visit poster's website
HelpSeeker
Guest





PostPosted: Feb 17, 2005 9:13 am    Post subject: ... some more info on initialisation Reply with quote

perhaps this is useful in finding the problem
in the application the init. is done by:

theApp
(...)
Code:

#ifdef LWLANGPACK
#include "LocWiseLib.h"
#include "LcwLocalization.h"
#endif


(...)

Code:

BOOL CMyApp::InitInstance()
(...) // some other stuff

#ifdef LWLANGPACK
   int ret;
   char *poi;

   TRACE0("LocWise LcwInitLocalization()...\n");
   LcwInitLocalization();

   nLen=strlen(buffer);
   ASSERT(nLen>4 && buffer[nLen-4]=='.');
   nLen-=4;
   buffer[nLen]='\0';

   poi=buffer+nLen;
      while(*poi!='\\' && poi!=buffer)
      {
         poi--;
      }
      if(poi!=buffer)
      {
         // The backslash is kept
         *(poi+1)='\0';
      }      
   
   TRACE("Startdirectory: %s\n",buffer);

   ret=LcwLoadLangs(buffer,_T("Error_ENU.lng")); // hard coded for testing

   TRACE("Loaded %d language packs\n",ret);

   switch(ret)
   {
   case 0:
      TRACE("No language packs found!\n");
      break;
   case 1:
      if(!LcwSetCurrentLang(LcwGetLangHead()))
      {
            TRACE0("Error loading head language pack\n");
      }
         
      break;
   default:
      TRACE("More than one language packs found, using LCID=0x0409\n");
      if(!LcwSetCurrentLang(0x0409))
      {
         TRACE0("Could not load language pack LCID=0x0409\n");
         TRACE0("Setting head language pack from loaded language packs\n");
         if(!LcwSetCurrentLang(LcwGetLangHead()))
         {
            TRACE0("Error loading head language pack\n");
         }
      }
      break;
   }
   LANGNODE *lang=LcwGetCurrentLangNode();
   if(lang==NULL)
   {
      TRACE0("No current language pack!\n");
   }
   else
   {
      TRACE("Current language pack: %04X Name: %s Path: %s\n",lang->nLangID,lang->szLang,lang->szLangFileA);
   }
#endif
Back to top
Support
Site Admin


Joined: 03 Nov 2002
Posts: 118

PostPosted: Feb 17, 2005 9:57 am    Post subject: Reply with quote

Can you get a string by using CString::LoadString function instead of using LcwLoadString function in you LoadLanguagePackString function? And is the LoadLanguagePackString function located in an MFC extension DLL? What version of LocWise are you using?
_________________
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