Re: Menu Item problem (was Notepad not remaining language selection)
I'm sorry for the delay. Could you please be more specific what functionality do you need? I'll provide as much details as I can.
No problem. It seemed that wineconsole has the correct implementation to use langage dependant menus. I looked in the code and saw the LoadString function looks as the main key to have string resources loaded with the local system language. So how could I rewrite the language resource files to handle them like wineconsole do ? I'm a newbie in windows programming for now(not C programming). My assignation is to remove the "Language" menu and let the system do the chice of the language. After this one, all other programs should be updated to handle language. ___________________________________________________________ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com
"Sylvain Petreolle" <spetreolle(a)yahoo.fr> wrote:
It seemed that wineconsole has the correct implementation to use langage dependant menus. I looked in the code and saw the LoadString function looks as the main key to have string resources loaded with the local system language.
I coudln't find any LoadString in the wineconsole code. Moreover I accidently found a bug in wineconsole_Fr.rc (French resources) which contains in the very first line LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT. Very likely a cut&paste bug.
So how could I rewrite the language resource files to handle them like wineconsole do ? I'm a newbie in windows programming for now(not C programming).
Basically all you need is to surround the resources targeted for different languages by LANGUAGE [main_lang],[sub_lang] statement. Then just use conventional LoadString, LoadMenu, etc. functions. They use FindResource internally, which in turn does search for language dependent resources using algorithm described in loader/pe_resource.c/PE_FindResourceW. See dlls/kernel/locale_rc.rc, dlls/kernel/nls/*.nls for string tables for many different languages but using the same IDs. They are used by ole/ole2nls.c/GetLocaleInfo. A much more powerful way to do things would be to use FindResourceEx, but I would not recommend it, because it adds more power, but requires more attention since FindResourceEx is not allowed to return any language resource like FindResource (see PE_FindResourceExW). Here is an example of using of FindResourceEx to create a dialog explicitly requesting English resources: HANDLE hRsrc = FindResourceEx(hInstance, RT_DIALOG, MAKEINTRESOURCE(1), \ MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT)); VOID *tmplate = LoadResource(hInstance, hRsrc); DialogBoxIndirectParam(hInstance, tmplate, 0, MyDlgProc, 0); As I mentioned above, you would better replace FindResourceEx by simple FindResource here. It will provide a graceful rollback in the case if resource for a specific language is not exist. Good luck. -- Dmitry.
--- Dmitry Timoshkov <dmitry(a)baikal.ru> wrote:
"Sylvain Petreolle" <spetreolle(a)yahoo.fr> wrote:
It seemed that wineconsole has the correct implementation to use langage dependant menus. I looked in the code and saw the LoadString function looks as the main key to have string resources loaded with the local system language.
I coudln't find any LoadString in the wineconsole code.
Hmm, I can see LoadString calls all over the place in dialog.c and user.c. I assume that Sylvain can use this code as an example. Andriy Palamarchuk __________________________________________________ Do You Yahoo!? Yahoo! Greetings - Send FREE e-cards for every occasion! http://greetings.yahoo.com
"Andriy Palamarchuk" <apa3a(a)yahoo.com> wrote:
I coudln't find any LoadString in the wineconsole code.
Hmm, I can see LoadString calls all over the place in dialog.c and user.c. I assume that Sylvain can use this code as an example.
Oh, I'm very sorry for misleading information. I had seached for real names LoadStringA/W, not for simple LoadString. Sorry again. -- Dmitry.
participants (3)
-
Andriy Palamarchuk -
Dmitry Timoshkov -
Sylvain Petreolle