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.