473,386 Members | 1,775 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,386 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 3131
> 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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.