Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stringtables and resource file 1

Status
Not open for further replies.

Denaeghel

Programmer
Apr 23, 2001
61
BE
How can I change a string table in the resource file (ex. I have a string table for Dutch and for French) when I'm using the same OS (WIN 2000 - English). I know that the resource file change when you have a different language of OS, but is it possible (without put French and Dutch in the same stringtable) to change it.

Perhaps it possible to change LCID or is there some API-function??

Thanks
 
What I've done in the past is create a DLL to do this. There are several ways to do it.

Example 1:

Create a DLL and include your resource file in the DLL. Create public menthod in the DLL called GetResString(lngIndex As Long) As String. Have your program call this function to get the string from the DLL. If you want multiple languages in one DLL then you have to define offsets for each language. So for English you might set aside 1 thru 1999, then for Dutch set aside 2000 thru 3999, etc for each language. Then all you have to do is send the ID for the string to the function and add the offset for each language. For example if the string at location 1 was "Hello", then your code would look like this:

strPhrase = obj.GetResString(1 + lngLanguageOffset)

If you want it in English, lngLanguageOffset = 0, if you want it in Dutch, then lngLanguageOffset = 2000, etc for each language you have in the resource file.

Example 2:

The other way to do it is to create the base language as you did in the first example and compiple the DLL. After you compile the DLL, go to the project and set "Binary Compatability Mode" for the DLL. Then copy the DLL to a new language directory, use the a different RES file and recompile. This gives you a different language for each DLL. Then all you have to do is register the approriate DLL to change the language. If you don't use Binary Compatability IT WON'T WORK! Snaggs
tribesaddict@swbell.net
To define recursion, we must first define recursion.
 
Can you tell how to create the DLL-file. I always get the error 453: Can't find DLL-entry point ...
 
When you open a new project, instead of selecting and 'Standard EXE', select 'ActiveX DLL'. You have to add a class to the project and give it the method that I mentioned above. Send me your email address and I'll email the class to you. Just click on the tribesaddict@swbell.net below in this message and send me a message requesting the 'resource class'.

One thing I did forget to mention is that if you put all the languages in the same resource file / dll, you might have some problems getting the correct text to show up since you should set the Code Page for each language. If you put them all in one file, then you can only have one code page per DLL. Depending on the languages you're using, this may or may not work. Snaggs
tribesaddict@swbell.net
To define recursion, we must first define recursion.
 
Be sure to include your email address in the body of the message or I won't be able to respond to you till I get home. Snaggs
tribesaddict@swbell.net
To define recursion, we must first define recursion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top