06170304.txt 17-Jun-00


Extracting a resource from a DLL

I need to extract a stringtable resource from a VO dll.
Does anybody have experience on how to do this?

TIA
Jan


Jan,

This is from Cavo25.hlp, _GetInst() Function
FUNCTION Start()
LOCAL x := Buffer(64) AS STRING
  LOCAL cb AS WORD
  cb := LoadString(_GetInst(), 100, x, 64)
  x := Left(x, cb)
  ? x         // Hello World
RESOURCE StringTable
  {
    100, "Hello World"
  }
LoadResString() Function
oDCMyControl:HyperLabel := HyperLabel{#MyControl, ;
  LoadResString("&File", MyFileString, MyLanguage),,}
DEFINE MyFileString := 100
GLOBAL MyLanguage AS STRING
METHOD Start() CLASS App
  ...
  IF ...      // it's French
  MyLanguage := "MYFRENCH.DLL"
  ELSEIF ... // it's German
     MyLanguage := "MYGERMAN.DLL"
  ENDIF
  RETURN NULL_STRING
The code for the MYFRENCH DLL string table would be as
  follows:
DEFINE MyFileString := 100
RESOURCE French STRINGTABLE
  BEGIN
    MyFileString, "&Fichier"
    ...
  END
The code for the MYGERMAN DLL string table would be as
  follows:
DEFINE MyFileString := 100
RESOURCE German STRINGTABLE
  BEGIN
    MyFileString, "&Datei"
    ...
  END
And at 2000.01.13 a thread call "Multiple Language Support"
  also talk about this.

Regards,
Wong

Wong,

Thanks for your answer!
It works excellent!

Jan


Folow this little example. It loads DLL to memory, takes 1st
  string and then removes DLL out.
=============
LOCAL hHandle AS PTR, cText as STRING
  hHandle:=LoadLibrary( PSZ(_CAST, "C:\MyLibrary.DLL") )
  cText := LoadResString( "Default Text (may be NULL)", ;
    1, "C:\MyLibrary.DLL")
  FreeLibrary( hHandle )
=============
For more informations take a look to LoadResString() in
  CAVO25.hlp and for LoadLibrary() and FreeLibrary() in
  Win32sdk.hlp.

HTH,
Pavel

Thanks Pavel,

Your reply became visible very late (this morning!)
Wong pointed me in the right direction and I have already
  found the solution.

Jan

    Source: geocities.com/n_s_wong/vo/ng

               ( geocities.com/n_s_wong/vo)                   ( geocities.com/n_s_wong)