Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FindResourceEx dependent on STRINGTABLE ordering in rc file :-(

3 views
Skip to first unread message

Steve Gruverman

unread,
Apr 13, 1998, 3:00:00 AM4/13/98
to

We have noticed a similar problem while experimenting prior to translating
one of our applications.
What seems to be happening, in out case anyway, is that unless resources of
a given type
are placed in the .RC file in descending language ID order, CVTRES
"forgets" to out the *data*
for at least one of the languages, in the binary. If you open the DLL/EXE
in Developers Studio
(as a resource, not a binary) you'll see a resource for that type and
language but it wont have
any data. You can similarly open the .RES file that the resource compiler
generates from the
..RC and I believe that all the resourecs will have data. (That's why we
suspect CVTRES).

Any corrections or clarifications of this would be welcome. (Even better
would be info on a bug
fix!). We'll probably end up putting resources in separate DLLs for each
language, but it would be
nice to have an alternative.

Hope this helps,
Steve Gruverman

Richard Browne <ri...@pobox.com.au> wrote in article
<euWUBTu...@uppssnewspub05.moswest.msn.net>...
> Someone else must have come across this by now? FindResourceEx works
> intermittently, depending on the order I specify STRINGTABLEs in the .rc
> file. Given this excerp from an .rc file:
>
> STRINGTABLE DISCARDABLE
> LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
> BEGIN
> IDS_STRING1 "String 1 (U.S.)"
> END
>
> STRINGTABLE DISCARDABLE
> LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
> BEGIN
> IDS_STRING1 "String 1 (U.K.)"
> END
>
> STRINGTABLE DISCARDABLE
> LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
> BEGIN
> IDS_STRING1 "String 1 (Australian)"
> END
>
> The following fails:
>
> unsigned resid = (IDS_STRING1 >> 4) + 1;
> HRSRC hrsrc = FindResourceEx(hInstance, RT_STRING,
MAKEINTRESOURCE(resid),
> MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US));
> hrsrc = FindResourceEx(hInstance, RT_STRING, MAKEINTRESOURCE(resid),
> MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_UK));
> hrsrc = FindResourceEx(hInstance, RT_STRING, MAKEINTRESOURCE(resid),
> MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_AUS));
>
> From the above, hrsrc0 and hrsrc2 are null and GetLastError reports
> "Resource language not found". hrsrc1 returns a valid resource handle.
Note
> on my system UK is *not* the default locale.
>
> Now, if I simply re-order the rc file, thus:
>
> STRINGTABLE DISCARDABLE
> LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
> BEGIN
> IDS_STRING1 "String 1 (Australian)"
> END
>
> STRINGTABLE DISCARDABLE
> LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
> BEGIN
> IDS_STRING1 "String 1 (U.K.)"
> END
>
> STRINGTABLE DISCARDABLE
> LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
> BEGIN
> IDS_STRING1 "String 1 (U.S.)"
> END
>
> The exact same code now works for all three languages. Go figure.
> Interestingly, when I try EnumResourceLanguages, my callback *does* get
> invoked for each version of the string table - regardless of .rc file
> ordering.
>
> I'm on NT 4 SP3.
>
> Alas, we're using appstudio so we do not have control over RC file
ordering.
> I'd love to hear if anyone else has come across this problem... hopefully
> with a workaround that will work with appstudio.
>
> yikes!
>
> richard browne.
>
>
>
>

Richard Browne

unread,
Apr 14, 1998, 3:00:00 AM4/14/98
to
0 new messages