A resource segue, #1

by Michael S. Kaplan, published on 2011/03/10, original URI: http://blogs.msdn.com/b/michkap/archive/2011/03/10/10139120.aspx

So it started with a discussion of the Win32 resource model and how it was affected by the world of MUI (both the earlier MUI model and the one of Vista and beyond).

The most important principle in the conversation relates to the resource enumeration functions -- they are mostly unable to really distinguish between the following two cases:

Thus let's say I am on one of my Windows 7 machines with many languages installed:

Now if I open up NOTEPAD.EXE in Visual Studio as a resource, the view appears like it is one file containing all the resources, despite the fact that the language-specific resources are all in separate, individual files:

Now there are several interesting things to note here beyond this virtual view I mentioned.

For example, there is the unknown Bengali sublanguage (SUBLANG_BENGALI_BANGLADESH).

And there are the various unknown languages:

Of course Visual Studio could have queried the locale names from the OS any time, so the only time there "unknown" items should show up is when the locales in question are unknownon th OS upon which you are runninfg.

Thus if Visual Studio were designed properly here and not duplicating the exact same resources all over again (and dealing with the same geopol review issues all over again, etc.), the problem should only happen when lookng at (for example) these Windows 7 files when looking at them on a Vista machine. Perhaps they could have saved the money and used it to localize something else. :-)

If you so ahead and save the resource block as either .RES or .RC, it combines all languages in one file.

I guess this kind of underscores how the underlying layout of the resources is largely not visible to where the resources are coming from.

Now of course anyone can do the same here through use of the EnumResourceTypes/EnumResourceNames/EnumResourceLanguages functions.

Or maybe the EnumResourceTypesEx/EnumResourceNamesEx/EnumResourceLanguagesEx functions. Though I doubt Visual Studio is calling the new functions, though doing so gives a few more options to help determine where the resources might be coming from or filtering them if desired. In a way the old functions are the ones that are transparent here; it might be interesting to consider the most efficient algorithm one could use EnumResourceTypesEx/EnumResourceNamesEx/EnumResourceLanguagesEx with to mark language neutral and language-specific resources....

There's more, but I'll cover it next time.

comments not archived

referenced by

2011/03/11 A resource segue, #2 (architecting the wheels off the wagon, a bit)

go to newer or older post, or back to index or month or day