Re: Importing MFC resources
"Mihai N." <nmihai_year_2000@yahoo.com> wrote in message
news:Xns99B6EFB86F721MihaiN@207.46.248.16...
I still don't see the advantage of using UINTs instead of strings,
although
in another post you said strings could not be used for certain kind of
resource types like stringtables.
1. If I do GetString( "idHelo" ) [typo], I get not compile time error if
idHelo resource string is not defined, I get a runtime error.
If I do GetString( idHelo ), I get a compile time error (because the
resource.h file defines idHello, not idHelo)
But resource.h could just as well have
#define ID_HELLO _T("THIS_IS_THE RESOURCE_HANDLE_FOR_HELLO")
and the code could refererence ID_HELLO as it does today and get the
compiler error.
2. Speed: it is faster to do a numeric lookup than a string lookup
True, but since the resource API's take string parameters as opposed to
numeric ones (e.g. FindResourceEx), it would seem there is no speed
advantage.
3. Size: a numeric ID takes 16 bytes. A string id takes more.
Actually, a numeric ID (UINT) takes 4 bytes, and you're right a string takes
more.
But you can still use string IDs for dialogs.
Why only for dialogs?
-- David