Page 1 of 2

Location of Windows system strings

Posted: Fri Oct 13, 2006 10:31 pm
by Fluid Byte
I'm working on a custom GUI set and I also want to completely modify the look of a window system menu. In order to be 100% compatible I always want to display the strings in the corresponding OS language. Currently all items are in english but if you run it on a german OS the menu item labels should be in german as well.

So does anybody know where these specific strings are stored? I already checked shell32.dll and user32.dll with a resource editor. Haven't found aynthing close to this.

Posted: Fri Oct 13, 2006 10:47 pm
by Edwin Knoppert
GetSystemMenu_() API and ModifyMenu_() should do imo.
See #SC_.. constants

Posted: Sat Oct 14, 2006 8:55 pm
by Fluid Byte
I can't use GetSystemMenu_() because my windows don't have the #WM_SYSMENU style. It's a little complicated to explain but it has to do with my way of event processing. So I'm stll interested where these strings are stored.

Posted: Thu Oct 19, 2006 8:44 pm
by technicorn
What function are you using to create the menus?
Are you using MenuTitle() and MenuItem() ?

Anyway, if you run a normal windows, that is one especial for the country it it intedet to sell to,
I don't think you will find any translated strings in the Windows DLLs,
as they are localiced to the specific country.

Same goes for system error messages, if you have an english Windows installed, you will only get the english error messages.

I could be wrong, but I think this is an MS thing for not being able to sell copies from one country to another.

There are multilingual Windows version, but most are not.

Just tried Windows function FormatMessage() with different language IDs,
for anything but the default language ID (which is 0), it will not return any string.

BTW: If you use fixed strings with MenuTitle/MenuItem ( for example MenuTitle("&File") ), you will never
get any automatic translation, because they are passed as they are written in your program.

Posted: Thu Oct 19, 2006 9:33 pm
by Fluid Byte
What function are you using to create the menus?
Are you using MenuTitle() and MenuItem() ?
See below:

Code: Select all

hMenuSys = CreatePopupMenu(0)

MenuItem(#SC_RESTORE,"Restore")
MenuItem(#SC_MOVE,"Move")
MenuItem(#SC_SIZE,"Size")
MenuItem(#SC_MINIMIZE,"Minimize")
MenuItem(#SC_MAXIMIZE,"Maximize")
MenuBar()
MenuItem(#SC_CLOSE,"Close"  + Chr(9) + "Alt+F4")

lpmii.MENUITEMINFO
lpmii\cbSize = SizeOf(MENUITEMINFO)
lpmii\fMask = #MIIM_STATE
lpmii\fState = #MFS_DEFAULT
SetMenuItemInfo_(hMenuSys,#SC_RESTORE,0,lpmii)
Anyway, if you run a normal windows, that is one especial for the country it it intedet to sell to, I don't think you will find any translated strings in the Windows DLLs, as they are localiced to the specific country.
I think you misundertsand me here. I'm not looking for translated strings nor do I want to detect wich language an OS is running to translate my menu strings acordingly. I am looking for their location as they are stored in a system DLL or similar. Just like any other language dependent string.

Just an example:

1.) Get a resource editor like ResourceHacker
2.) Open shell32.dll
3.) Open the "String Table" resource
4.) Open Item #396 and view it's content

If you done everything right you should see the following data:
6327, "Eine Datei mit dem angegebenen Namen ist bereits vorhanden. Geben Sie einen anderen Dateinamen an."
This is the german message for:
6327, "A file with the specified name already exists. Enter another filename."
So this particular string has an ID of #6327. This indentifier is equal on ALL Windows Systems. So if you now create an application and load the string from the shell32.dll with the ID of #6327 it will output the same result regardless wich language your OS is running in.

Hope the helped to clarify my request.

PS: Ich komm' auch aus Hamburg! :wink:

Posted: Thu Oct 19, 2006 10:26 pm
by technicorn
Hi Fluid Byte,

nice to see a fellow "hamburger" :P

Ok, I got me the ResourceHacker and used it as in your example
and got the same result, but now I'm confused,
what strings are you looking for exactly?

Are you looking for the "File", "Edit" ... or their german counterparts "Datei", "Bearbeiten" ... ?

Oh, and if you try to do a full text search on the Windows directory, you have to search for Unicode strings,
as that is the format they are stored in the DLLs, (at least here on XP)
and when you request such string for a Ansi program (unicode disabled under PB for example) it is coverted to Ansi on the fly.

So using the Windows find will not be of any help I think, as it only searches for Ansi (8-bit) strings.

You can use PSPad (free software), a mighty text editor, it has a build in file text search,
but you can also search for UTF-8 / UTF-16 strings in files.
It will list the found files and all locations of the strings within the files.
PSPad also has a hex editing function.

Hope that helps.

Posted: Fri Oct 20, 2006 11:47 am
by Sparkie
I found them in user32.dll.

Image

You can load the menu resource with LoadMenu_(), get the text using GetMenuString_() for each item, then discard the menu resource when done with DestroyMenu_().

Here are the item ID's if needed:

Code: Select all

#SysMenu_Restore = 61728
#SysMenu_Move = 61456
#SysMenu_Size = 61440
#SysMenu_Minimize = 61472
#SysMenu_Maximize = 61488
#SysMenu_Close = 61536

Posted: Fri Oct 20, 2006 6:34 pm
by Fluid Byte
Sparkie's da man bitches! W000t!?!? :shock:

Thank's a bunch mate you saved my day!

Actually I was looking in the user32.dll too but seemed to be too blind.

Oh well... :roll:

Also thanks to technicorn for trying to solving this issue :wink:

Posted: Sat Oct 21, 2006 12:37 am
by Sparkie
You're welcome :)

Posted: Sun Oct 22, 2006 3:49 pm
by Dr. Dri
I have the same question for MessageRequester buttons!!
Where can i found "OK" and "Cancel" strings ???

Dri

Posted: Mon Oct 23, 2006 3:21 am
by Sparkie
MessageRequester button text can be found in user32.dll. :)

Image

Posted: Mon Oct 23, 2006 9:22 pm
by Dr. Dri
Thank you :D

Dri :o

Posted: Thu Oct 09, 2008 3:30 am
by Fluid Byte
This is oooooooooooold, I know!

But this time I need the location of the strings for the popup menu of Windows system scrollbars.

* ACTIVATES BATSIGNAL *

Posted: Thu Oct 09, 2008 1:00 pm
by Sparkie
User32.dll > Menu > 80

Posted: Thu Oct 09, 2008 1:12 pm
by Fred
The dark knight to the rescue :)