473,322 Members | 1,522 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to change the interface language using resource.rc?


Hi, at first time I want to apologize for my English.

I need to change the language of my app and I like to do it changin
the caption of the controls in the resource.rc file, or having on
resource.rc file for each language, but then I need to use resource.r
file in the execution and not in the compile time, can I do it? How ca
I do it?.

Thank you
-
Kawor
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

Nov 17 '05 #1
1 3123
> Hi, at first time I want to apologize for my English.
No need to :-)
I need to change the language of my app and I like to do it changing
the caption of the controls in the resource.rc file, or having one
resource.rc file for each language, but then I need to use resource.rc
file in the execution and not in the compile time, can I do it? How can
I do it?.

You do not use the .rc at runtime, you use the resources compiled in a DLL.

How to to it:

1. Create a resource only dll (a DLL with no code)
1.1 Compile your .RC file using rc.exe. You will get a .res file
1.2 Link you .res in a dll uing link /dll /noentry

2. In the application, load the resources from the external DLL
2.1 Load the dll using LoadLibraryEx with the LOAD_LIBRARY_AS_DATAFILE flag.
You have to do this before you create the first window or load the first
string, or image, or whatever.
2.2 Save somewhere the library's HMODULE and use it for any resource
All API using resources ask for a hInstance. Use the hLibModule.
If you use MFC, call AfxSetResourceHandle( hLibModule )

A good way to store your localized files is to have a folder for all
languages (MS calls it MUI) and subfolders for each language
(MS uses the LCID as decimal or hex).
There you can put your localized .dll, help, readme, templates, etc.

Example:
<Program Files>
<Company>
<Product
<MUI>
<409>
MainApp.dll
MainApp.chm
<Templates>
SomeTemplate.x
AnotherTemplate.x
MoreTemplates.x
<411>
MainApp.dll
MainApp.chm
<Templates>
SomeTemplate.x
AnotherTemplate.x
MoreTemplates.x
<40C>
MainApp.dll
MainApp.chm
<Templates>
SomeTemplate.x
AnotherTemplate.x
MoreTemplates.x
Important: consider English to be just another language.
This way the code does not need to be different for English,
you can allways use <ApplicationPath>/MUI/<langCode>/... to
access your files.

--
Mihai Nita [Microsoft MVP, Windows - SDK]
------------------------------------------
Replace _year_ with _ to get the real email
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bj?rn | last post by:
HY, my problem is the following: I want to give a very big application the ability, to change the language at runtime. It's written in Visual C++ 6.0. All language depending strings and so...
5
by: Steven T. Hatton | last post by:
I'm forking this from a reply to John Nagle in the smart_ptr<> thread. To address some of the problems handled by the runtime environments of C# and Java, it may be necessary to look beyond the...
4
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an...
3
by: Xiaopeng Qu | last post by:
Hi, I installed DB2 8.1 Express with multiple language: English and Chinese, but the interface like: Control Center, CLP, etc alway display Chinese, is there a way to change the display language...
3
by: zlst | last post by:
Many technological innovations rely upon User Interface Design to elevate their technical complexity to a usable product. Technology alone may not win user acceptance and subsequent marketability....
21
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered...
2
by: Gwl | last post by:
I'm writing an application in which the user can change the default ouput language while the program is running. I have no problem to do it when there is only a form opened, but if I have a...
0
by: Kaworu | last post by:
Mihai N. wrote: > You do not use the .rc at runtime, you use the resources compiled in > a DLL. > > Hi, DLL system is running ok, thanks, but I'd like that the strings > for language interface...
3
by: Olivier Verdin | last post by:
Hi, I am developing a multi-language application in ASP.NET in c#. I am using a file field html control to upload an image. I would like to change the text on the button "browse" that comes...
6
by: Sharon | last post by:
Hi gurus, I have a Form with some controls, some of them are my own. The GUI text is shown in English US. This application is for our customer in Japan that ask to change the application GUI...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.